#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ collectPoms(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ slowForward(int);
void inchForwardPoms(int duration) {
  int inch;
  for (inch = 0; inch < duration;
       printf("incrementing: %d \n", inch++, duration)) {
    printf("inch beginning: %d \n", inch, duration);
    slowForward(200);
    collectPoms(4, 10);
    printf("inching: %d to %d \n", inch, duration);
  }
  printf("end: %d to %d \n", inch, duration);
}


x86 assembly (clang, -O0):
<inchForwardPoms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11aa <inchForwardPoms+0x7a>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0xc8,%edi
call   1030 <slowForward@plt>
mov    $0x4,%edi
mov    $0xa,%esi
call   1050 <collectPoms@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edx
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <inchForwardPoms+0x12>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inchForwardPoms>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
test   %edi,%edi
jle    11af <inchForwardPoms+0x7f>
xor    %ebx,%ebx
lea    0xeb5(%rip),%r14
lea    0xec3(%rip),%r15
lea    0xed0(%rip),%r12
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
call   1040 <printf@plt>
mov    $0xc8,%edi
call   1030 <slowForward@plt>
mov    $0x4,%edi
mov    $0xa,%esi
call   1050 <collectPoms@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
call   1040 <printf@plt>
lea    0x1(%rbx),%ebp
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
call   1040 <printf@plt>
mov    %ebp,%ebx
cmp    %ebp,%r13d
jne    1160 <inchForwardPoms+0x30>
mov    %r13d,%esi
jmp    11b1 <inchForwardPoms+0x81>
xor    %esi,%esi
lea    0xe84(%rip),%rdi
mov    %r13d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"inch beginning: %d \0A\00"
@.str.1 = [20 x i8] c"inching: %d to %d \0A\00"
@.str.2 = [19 x i8] c"incrementing: %d \0A\00"
@.str.3 = [16 x i8] c"end: %d to %d \0A\00"
define void @inchForwardPoms(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = call i32 @slowForward(i32 200)
%13 = call i32 @collectPoms(i32 4, i32 10)
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %15)
br label %17
17: ; preds = %8
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %20)
br label %4
22: ; preds = %4
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"inch beginning: %d \0A\00"
@.str.1 = [20 x i8] c"inching: %d to %d \0A\00"
@.str.2 = [19 x i8] c"incrementing: %d \0A\00"
@.str.3 = [16 x i8] c"end: %d to %d \0A\00"
define void @inchForwardPoms(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %12
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %0)
%6 = tail call i32 @slowForward(i32 200)
%7 = tail call i32 @collectPoms(i32 4, i32 10)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %0)
%9 = add nuw nsw i32 %4, 1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %0)
%11 = icmp eq i32 %9, %0
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %0, %3 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %0)
ret void
}