#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*/ assert(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ load(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char const *, char *);
int main(int argc, char const *argv[]) {
  FILE *in;
  if (argc == 2 && strcmp(argv[1], "COHADAR") == 0) {
    in = fopen("insertionsort-part1.in", "r");
    assert(in);
  } else {
    in = stdin;
  }
  load(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11a3 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a3 <main+0x63>
lea    0xe83(%rip),%rdi
lea    0xe93(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <assert@plt>
jmp    11b1 <main+0x71>
mov    0x2e3e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <load@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    115b <main+0x1b>
mov    0x8(%rsi),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1167 <main+0x27>
mov    0x2e86(%rip),%rax
mov    (%rax),%rbx
jmp    1185 <main+0x45>
lea    0xe9a(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1060 <load@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"COHADAR\00"
@.str.1 = [23 x i8] c"insertionsort-part1.in\00"
@.str.2 = [2 x i8] c"r\00"
@stdin = global i32* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = call i32 @assert(i32* %17)
br label %21
19: ; preds = %9, %2
%20 = load i32*, i32** @stdin
store i32* %20, i32** %6
br label %21
21: ; preds = %19, %15
%22 = load i32*, i32** %6
%23 = call i32 @load(i32* %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"COHADAR\00"
@.str.1 = [23 x i8] c"insertionsort-part1.in\00"
@.str.2 = [2 x i8] c"r\00"
@stdin = global i32* null
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @assert(i32* %10)
br label %14
12: ; preds = %4, %2
%13 = load i32*, i32** @stdin
br label %14
14: ; preds = %12, %9
%15 = phi i32* [ %10, %9 ], [ %13, %12 ]
%16 = tail call i32 @load(i32* %15)
ret i32 0
}