#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 option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ const member_1;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ generateFasta(char *, char *, char *, char *, int);
int /*<<< orphan*/ generateIndex(char *, char *);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
int /*<<< orphan*/ optarg;
#define optional_argument 129
#define required_argument 128
int /*<<< orphan*/ sscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char bedFile[100];
  char outputFasta[100];
  char sourceFasta[100];
  char indexFasta[100];
  int width = 300;
  int ch;
  FILE *file;
  static struct option long_options[] = {
      {"input-bed", required_argument, NULL, 'b'},
      {"output-fasta", required_argument, NULL, 'o'},
      {"source-fasta", required_argument, NULL, 's'},
      {"index_file", required_argument, NULL, 'i'},
      {"width", optional_argument, NULL, 'w'},
      {NULL, 0, NULL, 0}};
  while ((ch = getopt_long(argc, argv, "b:o:s:i:w:", long_options, NULL)) !=
         -1) {
    switch (ch) {
    case 'b':
      strcpy(bedFile, optarg);
      break;
    case 'o':
      strcpy(outputFasta, optarg);
      break;
    case 's':
      strcpy(sourceFasta, optarg);
      break;
    case 'i':
      strcpy(indexFasta, optarg);
      break;
    case 'w':
      sscanf(optarg, "%d", &width);
      break;
    }
  }
  file = fopen(indexFasta, "r");
  if (file == NULL) {
    fprintf(stderr, "Could not find the index file: %s\ngenerating %s now.\n",
            indexFasta, indexFasta);
    generateIndex(sourceFasta, indexFasta);
  } else
    fclose(file);
  generateFasta(sourceFasta, indexFasta, outputFasta, bedFile, width);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x12c,-0x1d4(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xedc(%rip),%rdx
lea    0x2eb8(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <getopt_long@plt>
mov    %eax,-0x1d8(%rbp)
cmp    $0xffffffff,%eax
je     1289 <main+0x109>
mov    -0x1d8(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x1e8(%rbp)
sub    $0x15,%eax
ja     1284 <main+0x104>
mov    -0x1e8(%rbp),%rax
lea    0xe06(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x80(%rbp),%rdi
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
call   1030 <strcpy@plt>
jmp    1284 <main+0x104>
lea    -0xf0(%rbp),%rdi
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
call   1030 <strcpy@plt>
jmp    1284 <main+0x104>
lea    -0x160(%rbp),%rdi
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
call   1030 <strcpy@plt>
jmp    1284 <main+0x104>
lea    -0x1d0(%rbp),%rdi
mov    0x2d9c(%rip),%rax
mov    (%rax),%esi
call   1030 <strcpy@plt>
jmp    1284 <main+0x104>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
lea    -0x1d4(%rbp),%rdx
call   1080 <sscanf@plt>
jmp    11a3 <main+0x23>
lea    -0x1d0(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x1e0(%rbp)
cmpq   $0x0,-0x1e0(%rbp)
jne    12ec <main+0x16c>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
lea    -0x1d0(%rbp),%rdx
lea    -0x1d0(%rbp),%rcx
lea    0xdce(%rip),%rsi
call   1070 <fprintf@plt>
lea    -0x160(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
call   1090 <generateIndex@plt>
jmp    12f8 <main+0x178>
mov    -0x1e0(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x160(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    -0x80(%rbp),%rcx
mov    -0x1d4(%rbp),%r8d
call   1060 <generateFasta@plt>
mov    -0x4(%rbp),%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x12c,0xc(%rsp)
lea    0xee8(%rip),%r14
lea    0x2ec4(%rip),%r15
lea    0xe4d(%rip),%r12
mov    0x2e3e(%rip),%r13
jmp    11e0 <main+0x60>
mov    0x0(%r13),%edi
lea    0xed1(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1080 <sscanf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1050 <getopt_long@plt>
lea    -0x62(%rax),%ecx
cmp    $0x15,%ecx
ja     124d <main+0xcd>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    0x0(%r13),%esi
lea    0x160(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    11e0 <main+0x60>
mov    0x0(%r13),%esi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    11e0 <main+0x60>
mov    0x0(%r13),%esi
lea    0xf0(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    11e0 <main+0x60>
mov    0x0(%r13),%esi
lea    0x80(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    11e0 <main+0x60>
cmp    $0xffffffff,%eax
jne    11e0 <main+0x60>
lea    0xe42(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1272 <main+0xf2>
mov    %rax,%rdi
call   1040 <fclose@plt>
jmp    12a2 <main+0x122>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
lea    0xe1b(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdx
mov    %rbx,%rcx
call   1070 <fprintf@plt>
lea    0x80(%rsp),%rdi
mov    %rbx,%rsi
call   1090 <generateIndex@plt>
mov    0xc(%rsp),%r8d
lea    0x80(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xf0(%rsp),%rdx
lea    0x160(%rsp),%rcx
call   1060 <generateFasta@plt>
xor    %eax,%eax
add    $0x1c8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@main.long_options = internal global [6 x %struct.option] [%struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 98 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32* null, i32 111 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32* null, i32 115 }, %struct.option { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8 -127, i32* null, i32 119 }, %struct.option zeroinitializer]
@.str = [10 x i8] c"input-bed\00"
@.str.1 = [13 x i8] c"output-fasta\00"
@.str.2 = [13 x i8] c"source-fasta\00"
@.str.3 = [11 x i8] c"index_file\00"
@.str.4 = [6 x i8] c"width\00"
@.str.5 = [11 x i8] c"b:o:s:i:w:\00"
@optarg = global i32 0
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.8 = [54 x i8] c"Could not find the index file: %s\0Agenerating %s now.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 300, i32* %10
br label %13
13: ; preds = %39, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt_long(i32 %14, i8** %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), %struct.option* getelementptr inbounds ([6 x %struct.option], [6 x %struct.option]* @main.long_options, i64 0, i64 0), i32* null)
store i32 %16, i32* %11
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %40
18: ; preds = %13
%19 = load i32, i32* %11
switch i32 %19, label %39 [
i32 98, label %20
i32 111, label %24
i32 115, label %28
i32 105, label %32
i32 119, label %36
]
20: ; preds = %18
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%22 = load i32, i32* @optarg
%23 = call i32 @strcpy(i8* %21, i32 %22)
br label %39
24: ; preds = %18
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* @optarg
%27 = call i32 @strcpy(i8* %25, i32 %26)
br label %39
28: ; preds = %18
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%30 = load i32, i32* @optarg
%31 = call i32 @strcpy(i8* %29, i32 %30)
br label %39
32: ; preds = %18
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%34 = load i32, i32* @optarg
%35 = call i32 @strcpy(i8* %33, i32 %34)
br label %39
36: ; preds = %18
%37 = load i32, i32* @optarg
%38 = call i32 @sscanf(i32 %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
br label %39
39: ; preds = %18, %36, %32, %28, %24, %20
br label %13
40: ; preds = %13
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %42, i32** %12
%43 = load i32*, i32** %12
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %53
45: ; preds = %40
%46 = load i32, i32* @stderr
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%49 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i8* %47, i8* %48)
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%52 = call i32 @generateIndex(i8* %50, i8* %51)
br label %56
53: ; preds = %40
%54 = load i32*, i32** %12
%55 = call i32 @fclose(i32* %54)
br label %56
56: ; preds = %53, %45
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%61 = load i32, i32* %10
%62 = call i32 @generateFasta(i8* %57, i8* %58, i8* %59, i8* %60, i32 %61)
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@main.long_options = internal global [6 x %struct.option] [%struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 98 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32* null, i32 111 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32* null, i32 115 }, %struct.option { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32* null, i32 105 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8 -127, i32* null, i32 119 }, %struct.option zeroinitializer]
@.str = [10 x i8] c"input-bed\00"
@.str.1 = [13 x i8] c"output-fasta\00"
@.str.2 = [13 x i8] c"source-fasta\00"
@.str.3 = [11 x i8] c"index_file\00"
@.str.4 = [6 x i8] c"width\00"
@.str.5 = [11 x i8] c"b:o:s:i:w:\00"
@optarg = global i32 0
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.8 = [54 x i8] c"Could not find the index file: %s\0Agenerating %s now.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%12 = bitcast i32* %7 to i8*
store i32 300, i32* %7
br label %13
13: ; preds = %15, %2
%14 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), %struct.option* getelementptr inbounds ([6 x %struct.option], [6 x %struct.option]* @main.long_options, i64 0, i64 0), i32* null)
switch i32 %14, label %15 [
i32 -1, label %31
i32 98, label %16
i32 111, label %19
i32 115, label %22
i32 105, label %25
i32 119, label %28
]
15: ; preds = %13, %28, %25, %22, %19, %16
br label %13
16: ; preds = %13
%17 = load i32, i32* @optarg
%18 = call i32 @strcpy(i8* %8, i32 %17)
br label %15
19: ; preds = %13
%20 = load i32, i32* @optarg
%21 = call i32 @strcpy(i8* %9, i32 %20)
br label %15
22: ; preds = %13
%23 = load i32, i32* @optarg
%24 = call i32 @strcpy(i8* %10, i32 %23)
br label %15
25: ; preds = %13
%26 = load i32, i32* @optarg
%27 = call i32 @strcpy(i8* %11, i32 %26)
br label %15
28: ; preds = %13
%29 = load i32, i32* @optarg
%30 = call i32 @sscanf(i32 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
br label %15
31: ; preds = %13
%32 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i8* %11, i8* %11)
%37 = call i32 @generateIndex(i8* %10, i8* %11)
br label %40
38: ; preds = %31
%39 = call i32 @fclose(i32* %32)
br label %40
40: ; preds = %38, %34
%41 = load i32, i32* %7
%42 = call i32 @generateFasta(i8* %10, i8* %11, i8* %9, i8* %8, i32 %41)
ret i32 0
}