#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 */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ setbitmap(int /*<<< orphan*/ *, int, int);
uint32_t fileBiggest(FILE *fp) {
  uint32_t a[(1024 * 1024)];
  int d, len;
  int size;
  uint32_t biggest = 0;
  while (!feof(fp)) {
    fscanf(fp, "%d", &d);
    setbitmap(a, (1024 * 1024), d);
  }
  return biggest;
}


x86 assembly (clang, -O0):
<fileBiggest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400020,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x400020(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1167 <fileBiggest+0x37>
jmp    119a <fileBiggest+0x6a>
mov    -0x8(%rbp),%rdi
lea    0xe8e(%rip),%rsi
lea    -0x400014(%rbp),%rdx
call   1030 <fscanf@plt>
lea    -0x400010(%rbp),%rdi
mov    -0x400014(%rbp),%edx
mov    $0x100000,%esi
call   1050 <setbitmap@plt>
jmp    1149 <fileBiggest+0x19>
mov    -0x400020(%rbp),%eax
add    $0x400020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileBiggest>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400018,%rsp
mov    %rdi,%rbx
call   1040 <feof@plt>
test   %eax,%eax
jne    118b <fileBiggest+0x5b>
lea    0xeaf(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <fscanf@plt>
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    $0x100000,%esi
call   1050 <setbitmap@plt>
mov    %rbx,%rdi
call   1040 <feof@plt>
test   %eax,%eax
je     1160 <fileBiggest+0x30>
xor    %eax,%eax
add    $0x400018,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @fileBiggest(i32* %0) {
%2 = alloca i32*
%3 = alloca [1048576 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %7
br label %8
8: ; preds = %13, %1
%9 = load i32*, i32** %2
%10 = call i32 @feof(i32* %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i32*, i32** %2
%15 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* %3, i64 0, i64 0
%17 = load i32, i32* %4
%18 = call i32 @setbitmap(i32* %16, i32 1048576, i32 %17)
br label %8
19: ; preds = %8
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @fileBiggest(i32* nocapture %0) {
%2 = alloca [1048576 x i32]
%3 = alloca i32
%4 = bitcast [1048576 x i32]* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @feof(i32* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* %2, i64 0, i64 0
br label %10
10: ; preds = %8, %10
%11 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = call i32 @setbitmap(i32* %9, i32 1048576, i32 %12)
%14 = call i32 @feof(i32* %0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %10, label %16
16: ; preds = %10, %1
ret i32 0
}