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

/* Variables and functions */
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ bcf_index_build(char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ stderr;
int main_bcfidx(int argc, char *argv[]) {
  int c, min_shift = 14;
  while ((c = getopt(argc, argv, "s:")) >= 0)
    if (c == 's')
      min_shift = atoi(optarg);
  if (optind == argc) {
    fprintf(stderr, "Usage: bgt bcfidx [-s minShift] <in.bcf>\n");
    return 1;
  }
  bcf_index_build(argv[optind], min_shift);
  return 0;
}


x86 assembly (clang, -O0):
<main_bcfidx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xe,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     1195 <main_bcfidx+0x55>
cmpl   $0x73,-0x14(%rbp)
jne    1190 <main_bcfidx+0x50>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1156 <main_bcfidx+0x16>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    11c8 <main_bcfidx+0x88>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e9 <main_bcfidx+0xa9>
mov    -0x10(%rbp),%rax
mov    0x2e0d(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%esi
call   1040 <bcf_index_build@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_bcfidx>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeac(%rip),%rdx
call   1050 <getopt@plt>
mov    $0xe,%r14d
test   %eax,%eax
js     11a4 <main_bcfidx+0x64>
mov    0x2e8e(%rip),%r12
lea    0xe8f(%rip),%r15
jmp    1191 <main_bcfidx+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <getopt@plt>
test   %eax,%eax
js     11a4 <main_bcfidx+0x64>
cmp    $0x73,%eax
jne    1180 <main_bcfidx+0x40>
mov    (%r12),%edi
call   1060 <atoi@plt>
mov    %eax,%r14d
jmp    1180 <main_bcfidx+0x40>
mov    0x2e35(%rip),%rax
movslq (%rax),%rax
cmp    %ebp,%eax
jne    11ce <main_bcfidx+0x8e>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
jmp    11dc <main_bcfidx+0x9c>
mov    (%rbx,%rax,8),%rdi
mov    %r14d,%esi
call   1040 <bcf_index_build@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"s:\00"
@optarg = global i32 0
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [42 x i8] c"Usage: bgt bcfidx [-s minShift] <in.bcf>\0A\00"
define i32 @main_bcfidx(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 14, i32* %7
br label %8
8: ; preds = %19, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 115
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @optarg
%18 = call i32 @atoi(i32 %17)
store i32 %18, i32* %7
br label %19
19: ; preds = %16, %13
br label %8
20: ; preds = %8
%21 = load i32, i32* @optind
%22 = load i32, i32* %4
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %35
27: ; preds = %20
%28 = load i8**, i8*** %5
%29 = load i32, i32* @optind
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = load i32, i32* %7
%34 = call i32 @bcf_index_build(i8* %32, i32 %33)
store i32 0, i32* %3
br label %35
35: ; preds = %27, %24
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [3 x i8] c"s:\00"
@optarg = global i32 0
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [42 x i8] c"Usage: bgt bcfidx [-s minShift] <in.bcf>\0A\00"
define i32 @main_bcfidx(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %16
5: ; preds = %2, %12
%6 = phi i32 [ %14, %12 ], [ %3, %2 ]
%7 = phi i32 [ %13, %12 ], [ 14, %2 ]
%8 = icmp eq i32 %6, 115
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* @optarg
%11 = tail call i32 @atoi(i32 %10)
br label %12
12: ; preds = %9, %5
%13 = phi i32 [ %11, %9 ], [ %7, %5 ]
%14 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp sgt i32 %14, -1
br i1 %15, label %5, label %16
16: ; preds = %12, %2
%17 = phi i32 [ 14, %2 ], [ %13, %12 ]
%18 = load i32, i32* @optind
%19 = icmp eq i32 %18, %0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
br label %28
23: ; preds = %16
%24 = sext i32 %18 to i64
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = tail call i32 @bcf_index_build(i8* %26, i32 %17)
br label %28
28: ; preds = %23, %20
%29 = phi i32 [ 1, %20 ], [ 0, %23 ]
ret i32 %29
}