int main(argc, argv)
int argc;
char **argv;
{
  int ncid;
  int i;
  int w[4];
  if (argc != 4 + 1) {
    usage(argv);
    return -1;
  }
  for (i = 0; i < 4; i++)
    w[i] = atoi(argv[i + 1]);
  ncid = nccreate("benchmark.nc", 0);
  test_slabs(ncid, w);
  ncclose(ncid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     1187 <main+0x37>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fa <main+0xaa>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    11c8 <main+0x78>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1050 <atoi@plt>
mov    %eax,%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118e <main+0x3e>
lea    0xe31(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <nccreate@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1060 <test_slabs@plt>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1070 <ncclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x5,%edi
jne    11c4 <main+0x74>
mov    0x8(%rbx),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <atoi@plt>
mov    %eax,(%rsp)
mov    0x10(%rbx),%rdi
xor    %eax,%eax
call   1050 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x18(%rbx),%rdi
xor    %eax,%eax
call   1050 <atoi@plt>
mov    %eax,0x8(%rsp)
mov    0x20(%rbx),%rdi
xor    %eax,%eax
call   1050 <atoi@plt>
mov    %eax,0xc(%rsp)
lea    0xe5e(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <nccreate@plt>
mov    %eax,%ebx
mov    %rsp,%rsi
mov    %eax,%edi
xor    %eax,%eax
call   1060 <test_slabs@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1070 <ncclose@plt>
jmp    11d3 <main+0x83>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <usage@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"benchmark.nc\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 5
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = call i32 (i8**, ...) bitcast (i32 (...)* @usage to i32 (i8**, ...)*)(i8** %12)
store i32 -1, i32* %3
br label %39
14: ; preds = %2
store i32 0, i32* %7
br label %15
15: ; preds = %29, %14
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %32
18: ; preds = %15
%19 = load i8**, i8*** %5
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %19, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %24)
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 %27
store i32 %25, i32* %28
br label %29
29: ; preds = %18
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %15
32: ; preds = %15
%33 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @nccreate to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%36 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @test_slabs to i32 (i32, i32*, ...)*)(i32 %34, i32* %35)
%37 = load i32, i32* %6
%38 = call i32 (i32, ...) bitcast (i32 (...)* @ncclose to i32 (i32, ...)*)(i32 %37)
store i32 0, i32* %3
br label %39
39: ; preds = %32, %11
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [13 x i8] c"benchmark.nc\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = icmp eq i32 %0, 5
br i1 %5, label %6, label %26
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %8)
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32 %9, i32* %10
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %12)
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
store i32 %13, i32* %14
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %16)
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
store i32 %17, i32* %18
%19 = getelementptr inbounds i8*, i8** %1, i64 4
%20 = load i8*, i8** %19
%21 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %20)
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
store i32 %21, i32* %22
%23 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @nccreate to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
%24 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @test_slabs to i32 (i32, i32*, ...)*)(i32 %23, i32* %10)
%25 = call i32 (i32, ...) bitcast (i32 (...)* @ncclose to i32 (i32, ...)*)(i32 %23)
br label %28
26: ; preds = %2
%27 = tail call i32 (i8**, ...) bitcast (i32 (...)* @usage to i32 (i8**, ...)*)(i8** %1)
br label %28
28: ; preds = %6, %26
%29 = phi i32 [ -1, %26 ], [ 0, %6 ]
ret i32 %29
}