#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ usage();
int eg_decode_main(int argc, char *argv[]) {
  char *infile = NULL;
  int c;
  while ((c = getopt(argc, argv, "r:h?")) != -1) {
    switch (c) {
    case 'r':
      infile = optarg;
      break;
    case 'h':
    case '?':
      usage();
      exit(EXIT_SUCCESS);
    default:
      usage();
      exit(EXIT_FAILURE);
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<eg_decode_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeab(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     11de <eg_decode_main+0xae>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x3f,%eax
je     11af <eg_decode_main+0x7f>
jmp    117a <eg_decode_main+0x4a>
mov    -0x20(%rbp),%eax
sub    $0x68,%eax
je     11af <eg_decode_main+0x7f>
jmp    118b <eg_decode_main+0x5b>
mov    -0x20(%rbp),%eax
sub    $0x72,%eax
jne    11c4 <eg_decode_main+0x94>
jmp    119c <eg_decode_main+0x6c>
mov    0x2e55(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11d9 <eg_decode_main+0xa9>
mov    $0x0,%al
call   1030 <usage@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    $0x0,%al
call   1030 <usage@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
jmp    1147 <eg_decode_main+0x17>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<eg_decode_main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec0(%rip),%r14
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <getopt@plt>
cmp    $0x72,%eax
je     1140 <eg_decode_main+0x10>
cmp    $0xffffffff,%eax
je     1168 <eg_decode_main+0x38>
cmp    $0x68,%eax
je     1161 <eg_decode_main+0x31>
cmp    $0x3f,%eax
jne    1176 <eg_decode_main+0x46>
xor    %eax,%eax
call   1030 <usage@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <usage@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"r:h?\00"
@optarg = global i8* null
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @eg_decode_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* null, i8** %5
br label %7
7: ; preds = %24, %2
%8 = load i32, i32* %3
%9 = load i8**, i8*** %4
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %25
12: ; preds = %7
%13 = load i32, i32* %6
switch i32 %13, label %20 [
i32 114, label %14
i32 104, label %16
i32 63, label %16
]
14: ; preds = %12
%15 = load i8*, i8** @optarg
store i8* %15, i8** %5
br label %24
16: ; preds = %12, %12
%17 = call i32 (...) @usage()
%18 = load i32, i32* @EXIT_SUCCESS
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %12
%21 = call i32 (...) @usage()
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %14
br label %7
25: ; preds = %7
%26 = load i32, i32* @EXIT_SUCCESS
%27 = call i32 @exit(i32 %26)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"r:h?\00"
@optarg = global i8* null
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @eg_decode_main(i32 %0, i8** %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %9 [
i32 -1, label %13
i32 114, label %3
i32 104, label %5
i32 63, label %5
]
5: ; preds = %3, %3
%6 = tail call i32 (...) @usage()
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %3
%10 = tail call i32 (...) @usage()
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %3
%14 = load i32, i32* @EXIT_SUCCESS
%15 = tail call i32 @exit(i32 %14)
unreachable
}