#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 getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int oc;
  char *b_opt_arg;
  while ((oc = getopt(argc, argv, "ngl:")) != -1) {
    switch (oc) {
    case 'n':
      printf("New.\n");
      break;
    case 'g':
      printf("Great.\n");
      break;
    case 'l':
      b_opt_arg = optarg;
      printf("l is %s\n", b_opt_arg);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xebc(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11d6 <main+0xb6>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x67,%eax
je     119e <main+0x7e>
jmp    1169 <main+0x49>
mov    -0x24(%rbp),%eax
sub    $0x6c,%eax
je     11b1 <main+0x91>
jmp    117a <main+0x5a>
mov    -0x24(%rbp),%eax
sub    $0x6e,%eax
jne    11d1 <main+0xb1>
jmp    118b <main+0x6b>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
mov    0x2e40(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb9(%rip),%r14
mov    0x2eaa(%rip),%r15
lea    0xeb0(%rip),%r12
lea    0xeb9(%rip),%r13
jmp    116d <main+0x3d>
xchg   %ax,%ax
mov    (%r15),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x6b,%eax
jle    11a0 <main+0x70>
cmp    $0x6c,%eax
je     1160 <main+0x30>
cmp    $0x6e,%eax
jne    116d <main+0x3d>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    116d <main+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x67,%eax
jne    11b3 <main+0x83>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
jmp    116d <main+0x3d>
cmp    $0xffffffff,%eax
jne    116d <main+0x3d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"ngl:\00"
@.str.1 = [6 x i8] c"New.\0A\00"
@.str.2 = [8 x i8] c"Great.\0A\00"
@optarg = global i8* null
@.str.3 = [9 x i8] c"l is %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %23 [
i32 110, label %15
i32 103, label %17
i32 108, label %19
]
15: ; preds = %13
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %23
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %23
19: ; preds = %13
%20 = load i8*, i8** @optarg
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %13, %19, %17, %15
br label %8
24: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"ngl:\00"
@optarg = global i8* null
@.str.3 = [9 x i8] c"l is %s\0A\00"
@str = [7 x i8] c"Great.\00"
@str.4 = [5 x i8] c"New.\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %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 %5 [
i32 -1, label %13
i32 110, label %6
i32 103, label %8
i32 108, label %10
]
5: ; preds = %3, %10, %8, %6
br label %3
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
br label %5
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %5
10: ; preds = %3
%11 = load i8*, i8** @optarg
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %5
13: ; preds = %3
ret i32 0
}