; Hand-authored teaching equivalent. Contiguous, valid three-element input.
define i32 @sum3(ptr readonly %input) {
entry:
  br label %loop
loop:
  %i = phi i64 [ 0, %entry ], [ %i.next, %body ]
  %acc = phi i32 [ 0, %entry ], [ %next, %body ]
  %more = icmp slt i64 %i, 3
  br i1 %more, label %body, label %exit
body:
  %p = getelementptr i32, ptr %input, i64 %i
  %value = load i32, ptr %p, align 4
  %next = add i32 %acc, %value
  %i.next = add i64 %i, 1
  br label %loop
exit:
  ret i32 %acc
}
