#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 */
struct partymember {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct partymember *CreatePartyMember();
int /*<<< orphan*/ FreePartyMember(struct partymember *);
scalar_t__ LoadPartyMember(int /*<<< orphan*/ *, struct partymember *);
int /*<<< orphan*/ PrintCharacterStats2(struct partymember *);
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(struct partymember *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Expecting 1 argument\n");
    return 1;
  }
  FILE *file = fopen(argv[1], "rb");
  if (file == NULL) {
    fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno));
    return 1;
  }
  struct partymember *pm = CreatePartyMember();
  fseek(file, 0xC10A, 0);
  for (int i = 0; i < 30; i++) {
    if (i != 0)
      fprintf(stdout, "  ------\n");
    if (LoadPartyMember(file, pm)) {
      PrintCharacterStats2(pm);
      continue;
    }
    int err = ferror(file);
    if (err != 0)
      fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(err));
    else
      fprintf(stderr, "%s: %s: Unexpected EOF\n", argv[0], argv[1]);
    return 1;
  }
  fclose(file);
  FreePartyMember(pm);
  free(pm);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11f3 <main+0x43>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13a5 <main+0x1f5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe14(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    126f <main+0xbf>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    %rax,%r8
lea    0xdbd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13a5 <main+0x1f5>
mov    $0x0,%al
call   10c0 <CreatePartyMember@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0xc10a,%esi
xor    %edx,%edx
call   1090 <fseek@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x1e,-0x24(%rbp)
jge    1383 <main+0x1d3>
cmpl   $0x0,-0x24(%rbp)
je     12bc <main+0x10c>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
lea    0xd70(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <LoadPartyMember@plt>
cmp    $0x0,%rax
je     12e1 <main+0x131>
mov    -0x20(%rbp),%rdi
call   1050 <PrintCharacterStats2@plt>
jmp    1375 <main+0x1c5>
mov    -0x18(%rbp),%rdi
call   1040 <ferror@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1343 <main+0x193>
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%edi
call   10d0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    %rax,%r8
lea    0xce2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1369 <main+0x1b9>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xccd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13a5 <main+0x1f5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1291 <main+0xe1>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1070 <FreePartyMember@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    125f <main+0xaf>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe44(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1278 <main+0xc8>
mov    %rax,%r15
xor    %eax,%eax
call   10c0 <CreatePartyMember@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0xc10a,%esi
xor    %edx,%edx
call   1090 <fseek@plt>
mov    $0x1e,%ebp
mov    0x2dc8(%rip),%r13
lea    0xe16(%rip),%r12
nop
cmp    $0x1e,%ebp
je     1223 <main+0x73>
mov    0x0(%r13),%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10b0 <LoadPartyMember@plt>
test   %rax,%rax
je     12a4 <main+0xf4>
mov    %rbx,%rdi
call   1050 <PrintCharacterStats2@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0x60>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    %rbx,%rdi
call   1070 <FreePartyMember@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    12e5 <main+0x135>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
lea    0xd91(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    12e0 <main+0x130>
mov    0x2d61(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rbp
mov    0x8(%r14),%r14
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xd7c(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
jmp    12d3 <main+0x123>
mov    %r15,%rdi
call   1040 <ferror@plt>
mov    0x2d2d(%rip),%rcx
mov    (%rcx),%ebp
mov    (%r14),%rbx
mov    0x8(%r14),%r14
test   %eax,%eax
je     12f4 <main+0x144>
mov    %eax,%edi
call   10d0 <strerror@plt>
lea    0xd4b(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd34(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    12e0 <main+0x130>

LLVM IR (-O0):
%struct.partymember = type { i32 }
@stderr = global i32 0
@.str = [22 x i8] c"Expecting 1 argument\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [12 x i8] c"%s: %s: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
@.str.3 = [10 x i8] c" ------\0A\00"
@.str.4 = [24 x i8] c"%s: %s: Unexpected EOF\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca %struct.partymember*
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %90
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = load i32*, i32** %6
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %33
22: ; preds = %15
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8* %29, i8* %31)
store i32 1, i32* %3
br label %90
33: ; preds = %15
%34 = call %struct.partymember* (...) @CreatePartyMember()
store %struct.partymember* %34, %struct.partymember** %7
%35 = load i32*, i32** %6
%36 = call i32 @fseek(i32* %35, i32 49418, i32 0)
store i32 0, i32* %8
br label %37
37: ; preds = %80, %33
%38 = load i32, i32* %8
%39 = icmp slt i32 %38, 30
br i1 %39, label %40, label %83
40: ; preds = %37
%41 = load i32, i32* %8
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* @stdout
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %43, %40
%47 = load i32*, i32** %6
%48 = load %struct.partymember*, %struct.partymember** %7
%49 = call i64 @LoadPartyMember(i32* %47, %struct.partymember* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = load %struct.partymember*, %struct.partymember** %7
%53 = call i32 @PrintCharacterStats2(%struct.partymember* %52)
br label %80
54: ; preds = %46
%55 = load i32*, i32** %6
%56 = call i32 @ferror(i32* %55)
store i32 %56, i32* %9
%57 = load i32, i32* %9
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %70
59: ; preds = %54
%60 = load i32, i32* @stderr
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 0
%63 = load i8*, i8** %62
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = load i32, i32* %9
%68 = call i8* @strerror(i32 %67)
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %63, i8* %66, i8* %68)
br label %79
70: ; preds = %54
%71 = load i32, i32* @stderr
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 0
%74 = load i8*, i8** %73
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %74, i8* %77)
br label %79
79: ; preds = %70, %59
store i32 1, i32* %3
br label %90
80: ; preds = %51
%81 = load i32, i32* %8
%82 = add nsw i32 %81, 1
store i32 %82, i32* %8
br label %37
83: ; preds = %37
%84 = load i32*, i32** %6
%85 = call i32 @fclose(i32* %84)
%86 = load %struct.partymember*, %struct.partymember** %7
%87 = call i32 @FreePartyMember(%struct.partymember* %86)
%88 = load %struct.partymember*, %struct.partymember** %7
%89 = call i32 @free(%struct.partymember* %88)
store i32 0, i32* %3
br label %90
90: ; preds = %83, %79, %22, %12
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
%struct.partymember = type { i32 }
@stderr = global i32 0
@.str = [22 x i8] c"Expecting 1 argument\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [12 x i8] c"%s: %s: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
@.str.3 = [10 x i8] c" ------\0A\00"
@.str.4 = [24 x i8] c"%s: %s: Unexpected EOF\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %50
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %19
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = load i8*, i8** %8
%16 = load i32, i32* @errno
%17 = tail call i8* @strerror(i32 %16)
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15, i8* %17)
br label %50
19: ; preds = %7
%20 = tail call %struct.partymember* (...) @CreatePartyMember()
%21 = tail call i32 @fseek(i32* %10, i32 49418, i32 0)
br label %22
22: ; preds = %19, %31
%23 = phi i32 [ 0, %19 ], [ %33, %31 ]
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* @stdout
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %25, %22
%29 = tail call i64 @LoadPartyMember(i32* %10, %struct.partymember* %20)
%30 = icmp eq i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %28
%32 = tail call i32 @PrintCharacterStats2(%struct.partymember* %20)
%33 = add nuw nsw i32 %23, 1
%34 = icmp eq i32 %33, 30
br i1 %34, label %46, label %22
35: ; preds = %28
%36 = tail call i32 @ferror(i32* %10)
%37 = icmp eq i32 %36, 0
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %1
%40 = load i8*, i8** %8
br i1 %37, label %44, label %41
41: ; preds = %35
%42 = tail call i8* @strerror(i32 %36)
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* %40, i8* %42)
br label %50
44: ; preds = %35
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %39, i8* %40)
br label %50
46: ; preds = %31
%47 = tail call i32 @fclose(i32* %10)
%48 = tail call i32 @FreePartyMember(%struct.partymember* %20)
%49 = tail call i32 @free(%struct.partymember* %20)
br label %50
50: ; preds = %44, %41, %12, %46, %4
%51 = phi i32 [ 1, %4 ], [ 1, %12 ], [ 0, %46 ], [ 1, %41 ], [ 1, %44 ]
ret i32 %51
}