#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*/ gpsCatch(int);
char *lenCatch(int);
int /*<<< orphan*/ printf(char *, int, char *, int /*<<< orphan*/);
int totCatch();
void printCatch() {
  int i = 0, max = totCatch();
  while (++i <= max)
    printf("#%d# >%.*s<\n", i, lenCatch(i), gpsCatch(i));
}


x86 assembly (clang, -O0):
<printCatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <totCatch@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    -0x8(%rbp),%eax
jg     119f <printCatch+0x5f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <lenCatch@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <gpsCatch@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    %eax,%ecx
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    1159 <printCatch+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printCatch>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <totCatch@plt>
test   %eax,%eax
jle    11a3 <printCatch+0x63>
mov    %eax,%r15d
neg    %r15d
mov    $0x1,%ebx
lea    0xe9b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1060 <lenCatch@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1040 <gpsCatch@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1170 <printCatch+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"#%d# >%.*s<\0A\00"
define void @printCatch() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @totCatch()
store i32 %3, i32* %2
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %4
%10 = load i32, i32* %1
%11 = load i32, i32* %1
%12 = call i8* @lenCatch(i32 %11)
%13 = load i32, i32* %1
%14 = call i32 @gpsCatch(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %12, i32 %14)
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"#%d# >%.*s<\0A\00"
define void @printCatch() {
%1 = tail call i32 (...) @totCatch()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %10
3: ; preds = %0, %3
%4 = phi i32 [ %8, %3 ], [ 1, %0 ]
%5 = tail call i8* @lenCatch(i32 %4)
%6 = tail call i32 @gpsCatch(i32 %4)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %5, i32 %6)
%8 = add nuw i32 %4, 1
%9 = icmp eq i32 %4, %1
br i1 %9, label %10, label %3
10: ; preds = %3, %0
ret void
}