#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 */
char getopt(int, char **, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_file(char *);
int ini_cmd(int argc, char **argv) {
  int i;
  while (1) {
    char c;
    c = getopt(argc, argv, "xhi:");
    if (c == -1) {
      break;
    }
    switch (c) {
    case 'i':
      read_file(argv[2]);
      break;
    case 'h':
      help();
      break;
    case '?':
    default:
      printf("Usage: %s [-i] <filename.m++>.\n", argv[0]);
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<ini_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea3(%rip),%rdx
call   1050 <getopt@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0xffffffff,%eax
jne    1177 <ini_cmd+0x37>
jmp    11e9 <ini_cmd+0xa9>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x3f,%eax
je     11cc <ini_cmd+0x8c>
jmp    118c <ini_cmd+0x4c>
mov    -0x1c(%rbp),%eax
sub    $0x68,%eax
je     11c0 <ini_cmd+0x80>
jmp    119d <ini_cmd+0x5d>
mov    -0x1c(%rbp),%eax
sub    $0x69,%eax
jne    11d1 <ini_cmd+0x91>
jmp    11ae <ini_cmd+0x6e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <read_file@plt>
jmp    11e4 <ini_cmd+0xa4>
mov    $0x0,%al
call   1060 <help@plt>
jmp    11e4 <ini_cmd+0xa4>
jmp    11d1 <ini_cmd+0x91>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <ini_cmd+0xf>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ini_cmd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xead(%rip),%rdx
call   1050 <getopt@plt>
cmp    $0xff,%al
je     11b9 <ini_cmd+0x79>
lea    0xe9d(%rip),%r14
lea    0xe9b(%rip),%r15
jmp    118c <ini_cmd+0x4c>
nopl   0x0(%rax)
mov    (%rbx),%rsi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0xff,%al
je     11b9 <ini_cmd+0x79>
movsbl %al,%eax
cmp    $0x68,%eax
je     11b0 <ini_cmd+0x70>
cmp    $0x69,%eax
jne    1170 <ini_cmd+0x30>
mov    0x10(%rbx),%rdi
call   1040 <read_file@plt>
jmp    117b <ini_cmd+0x3b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <help@plt>
jmp    117b <ini_cmd+0x3b>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"xhi:\00"
@.str.1 = [32 x i8] c"Usage: %s [-i] <filename.m++>.\0A\00"
define i32 @ini_cmd(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %3
store i8** %1, i8*** %4
br label %7
7: ; preds = %2, %31
%8 = load i32, i32* %3
%9 = load i8**, i8*** %4
%10 = call signext i8 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8 %10, i8* %6
%11 = load i8, i8* %6
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %7
br label %32
15: ; preds = %7
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
switch i32 %17, label %26 [
i32 105, label %18
i32 104, label %23
i32 63, label %25
]
18: ; preds = %15
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @read_file(i8* %21)
br label %31
23: ; preds = %15
%24 = call i32 (...) @help()
br label %31
25: ; preds = %15
br label %26
26: ; preds = %15, %25
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %26, %23, %18
br label %7
32: ; preds = %14
ret i32 -1
}

LLVM IR (-O2):
@.str = [5 x i8] c"xhi:\00"
@.str.1 = [32 x i8] c"Usage: %s [-i] <filename.m++>.\0A\00"
define i32 @ini_cmd(i32 %0, i8** %1) {
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8 %3, -1
br i1 %4, label %21, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 2
br label %7
7: ; preds = %5, %18
%8 = phi i8 [ %3, %5 ], [ %19, %18 ]
%9 = sext i8 %8 to i32
switch i32 %9, label %15 [
i32 105, label %10
i32 104, label %13
]
10: ; preds = %7
%11 = load i8*, i8** %6
%12 = tail call i32 @read_file(i8* %11)
br label %18
13: ; preds = %7
%14 = tail call i32 (...) @help()
br label %18
15: ; preds = %7
%16 = load i8*, i8** %1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %10, %13, %15
%19 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i8 %19, -1
br i1 %20, label %21, label %7
21: ; preds = %18, %2
ret i32 -1
}