#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ burptest(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  FILE *f;
  char buffer[(8192)];
  int bufsize;
  if (argc < 2) {
    printf("usage:\t%s fichier.xml\n", argv[0]);
    return 1;
  }
  f = fopen(argv[1], "r");
  if (!f) {
    printf("cannot open file %s\n", argv[1]);
    return 1;
  }
  bufsize = fread(buffer, 1, (8192), f);
  fclose(f);
  burptest(buffer, bufsize);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1192 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1217 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d5 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe55(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1217 <main+0xc7>
lea    -0x2020(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2000,%edx
call   1030 <fread@plt>
mov    %eax,-0x2024(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x2024(%rbp),%esi
call   1060 <burptest@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x2000,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     116f <main+0x1f>
mov    (%rbx),%rsi
lea    0xe93(%rip),%rdi
jmp    11c2 <main+0x72>
mov    0x8(%rbx),%rdi
lea    0xe9d(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11b7 <main+0x67>
mov    %rax,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <burptest@plt>
xor    %eax,%eax
jmp    11cc <main+0x7c>
mov    0x8(%rbx),%rsi
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"usage:\09%s fichier.xml\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"cannot open file %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [8192 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %37
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = load i32*, i32** %6
%22 = icmp ne i32* %21, null
br i1 %22, label %28, label %23
23: ; preds = %16
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %26)
store i32 1, i32* %3
br label %37
28: ; preds = %16
%29 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%30 = load i32*, i32** %6
%31 = call i32 @fread(i8* %29, i32 1, i32 8192, i32* %30)
store i32 %31, i32* %8
%32 = load i32*, i32** %6
%33 = call i32 @fclose(i32* %32)
%34 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%35 = load i32, i32* %8
%36 = call i32 @burptest(i8* %34, i32 %35)
store i32 0, i32* %3
br label %37
37: ; preds = %28, %23, %11
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [23 x i8] c"usage:\09%s fichier.xml\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"cannot open file %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %21
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %21
17: ; preds = %9
%18 = call i32 @fread(i8* %4, i32 1, i32 8192, i32* %12)
%19 = tail call i32 @fclose(i32* %12)
%20 = call i32 @burptest(i8* %4, i32 %18)
br label %21
21: ; preds = %17, %14, %6
%22 = phi i32 [ 1, %6 ], [ 0, %17 ], [ 1, %14 ]
ret i32 %22
}