#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*/ print_stats(char **, int);
int /*<<< orphan*/ printf(char *, char *);
int stats_report(int *recnums, char **ptr, char **formlist, int numrecs,
                 int statsval) {
  int i;
  for (i = 0; i < numrecs; ++i)
    printf("%s\n", *(formlist + i));
  if (statsval == 1)
    print_stats(ptr, numrecs);
  return 0;
}


x86 assembly (clang, -O0):
<stats_report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1174 <stats_report+0x54>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <stats_report+0x22>
cmpl   $0x1,-0x20(%rbp)
jne    118a <stats_report+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <print_stats@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stats_report>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %rsi,(%rsp)
test   %ecx,%ecx
jle    1166 <stats_report+0x46>
mov    %rdx,%rbp
mov    %r12d,%ebx
xor    %r14d,%r14d
lea    0xeb7(%rip),%r13
nopl   0x0(%rax)
mov    0x0(%rbp,%r14,8),%rsi
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1150 <stats_report+0x30>
cmp    $0x1,%r15d
jne    1178 <stats_report+0x58>
mov    (%rsp),%rdi
mov    %r12d,%esi
call   1030 <print_stats@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @stats_report(i32* %0, i8** %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %6
store i8** %1, i8*** %7
store i8** %2, i8*** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %12
12: ; preds = %23, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %26
16: ; preds = %12
%17 = load i8**, i8*** %8
%18 = load i32, i32* %11
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %16
%24 = load i32, i32* %11
%25 = add nsw i32 %24, 1
store i32 %25, i32* %11
br label %12
26: ; preds = %12
%27 = load i32, i32* %10
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i8**, i8*** %7
%31 = load i32, i32* %9
%32 = call i32 @print_stats(i8** %30, i32 %31)
br label %33
33: ; preds = %29, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @stats_report(i32* nocapture readnone %0, i8** %1, i8** nocapture %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %16
7: ; preds = %5
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %14, %9 ]
%11 = getelementptr inbounds i8*, i8** %2, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %16, label %9
16: ; preds = %9, %5
%17 = icmp eq i32 %4, 1
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 @print_stats(i8** %1, i32 %3)
br label %20
20: ; preds = %18, %16
ret i32 0
}