#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ read_obs_seq_from_file(int /*<<< orphan*/ *, int *,
                                          char ***);
int /*<<< orphan*/ translate_seq(char *, int /*<<< orphan*/ *, char *);
int main(int argc, char **argv) {
  FILE *fp;
  int num_seqs;
  char **obs_seqs = NULL;
  char *seq_file = NULL;
  char *pep_file = NULL;
  char *head = NULL;
  char c;
  while ((c = getopt(argc, argv, "d:h:p:")) != -1) {
    switch (c) {
    case 'd':
      seq_file = optarg;
      break;
    case 'h':
      head = optarg;
      break;
    case 'p':
      pep_file = optarg;
      break;
    }
  }
  fp = fopen(seq_file, "r");
  read_obs_seq_from_file(fp, &num_seqs, &obs_seqs);
  fclose(fp);
  fp = fopen(pep_file, "w");
  translate_seq(obs_seqs[0], fp, head);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdx
call   1050 <getopt@plt>
mov    %al,-0x41(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     1218 <main+0xc8>
movsbl -0x41(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0x64,%eax
je     11df <main+0x8f>
jmp    11bd <main+0x6d>
mov    -0x48(%rbp),%eax
sub    $0x68,%eax
je     11f2 <main+0xa2>
jmp    11ce <main+0x7e>
mov    -0x48(%rbp),%eax
sub    $0x70,%eax
je     1205 <main+0xb5>
jmp    1213 <main+0xc3>
mov    0x2e12(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1213 <main+0xc3>
mov    0x2dff(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1213 <main+0xc3>
mov    0x2dec(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1186 <main+0x36>
mov    -0x30(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1070 <read_obs_seq_from_file@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x38(%rbp),%rdi
lea    0xdb8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1060 <translate_seq@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
lea    0xe8d(%rip),%rdx
call   1050 <getopt@plt>
cmp    $0xff,%al
je     11d9 <main+0x89>
xor    %r12d,%r12d
mov    0x2e72(%rip),%r14
lea    0xe73(%rip),%r13
xor    %ecx,%ecx
mov    %rcx,(%rsp)
xor    %r15d,%r15d
jmp    11b4 <main+0x64>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%r15
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1050 <getopt@plt>
cmp    $0xff,%al
je     11e5 <main+0x95>
movsbl %al,%eax
cmp    $0x70,%eax
je     11a0 <main+0x50>
cmp    $0x68,%eax
je     11d0 <main+0x80>
cmp    $0x64,%eax
jne    11a3 <main+0x53>
mov    (%r14),%r12
jmp    11a3 <main+0x53>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%rax
mov    %rax,(%rsp)
jmp    11a3 <main+0x53>
xor    %r15d,%r15d
xor    %eax,%eax
mov    %rax,(%rsp)
xor    %r12d,%r12d
lea    0xe1b(%rip),%rsi
mov    %r12,%rdi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0x14(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
call   1070 <read_obs_seq_from_file@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xdf1(%rip),%rsi
mov    %r15,%rdi
call   1040 <fopen@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
mov    %rbx,%rsi
mov    (%rsp),%rdx
call   1060 <translate_seq@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"d:h:p:\00"
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\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 i8**
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** null, i8*** %8
store i8* null, i8** %9
store i8* null, i8** %10
store i8* null, i8** %11
br label %13
13: ; preds = %28, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call signext i8 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8 %16, i8* %12
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %29
19: ; preds = %13
%20 = load i8, i8* %12
%21 = sext i8 %20 to i32
switch i32 %21, label %28 [
i32 100, label %22
i32 104, label %24
i32 112, label %26
]
22: ; preds = %19
%23 = load i8*, i8** @optarg
store i8* %23, i8** %9
br label %28
24: ; preds = %19
%25 = load i8*, i8** @optarg
store i8* %25, i8** %11
br label %28
26: ; preds = %19
%27 = load i8*, i8** @optarg
store i8* %27, i8** %10
br label %28
28: ; preds = %19, %26, %24, %22
br label %13
29: ; preds = %13
%30 = load i8*, i8** %9
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %6
%32 = load i32*, i32** %6
%33 = call i32 @read_obs_seq_from_file(i32* %32, i32* %7, i8*** %8)
%34 = load i32*, i32** %6
%35 = call i32 @fclose(i32* %34)
%36 = load i8*, i8** %10
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %37, i32** %6
%38 = load i8**, i8*** %8
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = load i32*, i32** %6
%42 = load i8*, i8** %11
%43 = call i32 @translate_seq(i8* %40, i32* %41, i8* %42)
%44 = load i32*, i32** %6
%45 = call i32 @fclose(i32* %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"d:h:p:\00"
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = bitcast i32* %3 to i8*
%6 = bitcast i8*** %4 to i8*
store i8** null, i8*** %4
%7 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8 %7, -1
br i1 %8, label %27, label %9
9: ; preds = %2, %21
%10 = phi i8 [ %25, %21 ], [ %7, %2 ]
%11 = phi i8* [ %24, %21 ], [ null, %2 ]
%12 = phi i8* [ %23, %21 ], [ null, %2 ]
%13 = phi i8* [ %22, %21 ], [ null, %2 ]
%14 = sext i8 %10 to i32
switch i32 %14, label %21 [
i32 100, label %15
i32 104, label %17
i32 112, label %19
]
15: ; preds = %9
%16 = load i8*, i8** @optarg
br label %21
17: ; preds = %9
%18 = load i8*, i8** @optarg
br label %21
19: ; preds = %9
%20 = load i8*, i8** @optarg
br label %21
21: ; preds = %9, %19, %17, %15
%22 = phi i8* [ %13, %9 ], [ %20, %19 ], [ %13, %17 ], [ %13, %15 ]
%23 = phi i8* [ %12, %9 ], [ %12, %19 ], [ %18, %17 ], [ %12, %15 ]
%24 = phi i8* [ %11, %9 ], [ %11, %19 ], [ %11, %17 ], [ %16, %15 ]
%25 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i8 %25, -1
br i1 %26, label %27, label %9
27: ; preds = %21, %2
%28 = phi i8* [ null, %2 ], [ %22, %21 ]
%29 = phi i8* [ null, %2 ], [ %23, %21 ]
%30 = phi i8* [ null, %2 ], [ %24, %21 ]
%31 = tail call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @read_obs_seq_from_file(i32* %31, i32* %3, i8*** %4)
%33 = call i32 @fclose(i32* %31)
%34 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = load i8**, i8*** %4
%36 = load i8*, i8** %35
%37 = call i32 @translate_seq(i8* %36, i32* %34, i8* %29)
%38 = call i32 @fclose(i32* %34)
ret i32 0
}