#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 */
scalar_t__ EOF;
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, ...);
int load_game(FILE *fp, long int *score, int *bombs, int *level, int *moves) {
  if (fscanf(fp, "%ld", score) == EOF)
    return 1;
  if (fscanf(fp, "%d", bombs) == EOF)
    return 1;
  if (fscanf(fp, "%d", level) == EOF)
    return 1;
  if (fscanf(fp, "%d", moves) == EOF)
    *moves = 0;
  return 0;
}


x86 assembly (clang, -O0):
<load_game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%rax
jne    115e <load_game+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    11f9 <load_game+0xe9>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
jne    1190 <load_game+0x80>
movl   $0x1,-0x4(%rbp)
jmp    11f9 <load_game+0xe9>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    0x2e3b(%rip),%rcx
cmp    (%rcx),%rax
jne    11c2 <load_game+0xb2>
movl   $0x1,-0x4(%rbp)
jmp    11f9 <load_game+0xe9>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    0x2e09(%rip),%rcx
cmp    (%rcx),%rax
jne    11f2 <load_game+0xe2>
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_game>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xecf(%rip),%rsi
xor    %eax,%eax
call   1030 <fscanf@plt>
mov    0x2ea9(%rip),%r13
mov    $0x1,%ebp
cmp    0x0(%r13),%rax
je     11a1 <load_game+0x91>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
cmp    0x0(%r13),%rax
je     11a1 <load_game+0x91>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
cmp    0x0(%r13),%rax
je     11a1 <load_game+0x91>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
cmp    0x0(%r13),%rax
jne    119f <load_game+0x8f>
movl   $0x0,(%r14)
xor    %ebp,%ebp
mov    %ebp,%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"%ld\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%d\00"
define i32 @load_game(i32* %0, i64* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i64*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32* %0, i32** %7
store i64* %1, i64** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%12 = load i32*, i32** %7
%13 = load i64*, i64** %8
%14 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %13)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %5
store i32 1, i32* %6
br label %41
18: ; preds = %5
%19 = load i32*, i32** %7
%20 = load i32*, i32** %9
%21 = call i64 (i32*, i8*, ...) @fscanf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = load i64, i64* @EOF
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 1, i32* %6
br label %41
25: ; preds = %18
%26 = load i32*, i32** %7
%27 = load i32*, i32** %10
%28 = call i64 (i32*, i8*, ...) @fscanf(i32* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
%29 = load i64, i64* @EOF
%30 = icmp eq i64 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %25
store i32 1, i32* %6
br label %41
32: ; preds = %25
%33 = load i32*, i32** %7
%34 = load i32*, i32** %11
%35 = call i64 (i32*, i8*, ...) @fscanf(i32* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
%36 = load i64, i64* @EOF
%37 = icmp eq i64 %35, %36
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = load i32*, i32** %11
store i32 0, i32* %39
br label %40
40: ; preds = %38, %32
store i32 0, i32* %6
br label %41
41: ; preds = %40, %31, %24, %17
%42 = load i32, i32* %6
ret i32 %42
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"%d\00"
define i32 @load_game(i32* nocapture %0, i64* %1, i32* %2, i32* %3, i32* %4) {
%6 = tail call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %22, label %9
9: ; preds = %5
%10 = tail call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
br i1 %12, label %22, label %13
13: ; preds = %9
%14 = tail call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %22, label %17
17: ; preds = %13
%18 = tail call i64 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %4
br label %22
22: ; preds = %17, %21, %13, %9, %5
%23 = phi i32 [ 1, %5 ], [ 1, %9 ], [ 1, %13 ], [ 0, %21 ], [ 0, %17 ]
ret i32 %23
}