#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;
    case '?':
      printf("arguments error!\n");
      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     11fa <main+0xda>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3f,%eax
je     11e7 <main+0xc7>
jmp    1169 <main+0x49>
mov    -0x24(%rbp),%eax
sub    $0x67,%eax
je     11af <main+0x8f>
jmp    117a <main+0x5a>
mov    -0x24(%rbp),%eax
sub    $0x6c,%eax
je     11c2 <main+0xa2>
jmp    118b <main+0x6b>
mov    -0x24(%rbp),%eax
sub    $0x6e,%eax
jne    11f5 <main+0xd5>
jmp    119c <main+0x7c>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
mov    0x2e2f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
lea    0xe2e(%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),%r12
lea    0xeb0(%rip),%r13
lea    0xeca(%rip),%r15
jmp    1170 <main+0x40>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x6b,%eax
jg     11a0 <main+0x70>
cmp    $0x3f,%eax
je     115e <main+0x2e>
cmp    $0x67,%eax
jne    11c4 <main+0x94>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
jmp    1170 <main+0x40>
nopw   0x0(%rax,%rax,1)
cmp    $0x6c,%eax
je     11b4 <main+0x84>
cmp    $0x6e,%eax
jne    1170 <main+0x40>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1170 <main+0x40>
mov    (%r12),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x40>
cmp    $0xffffffff,%eax
jne    1170 <main+0x40>
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"
@.str.4 = [18 x i8] c"arguments error!\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 = %25, %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 %26
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %25 [
i32 110, label %15
i32 103, label %17
i32 108, label %19
i32 63, label %23
]
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 %25
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 %25
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 %25
23: ; preds = %13
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %13, %23, %19, %17, %15
br label %8
26: ; 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 = [17 x i8] c"arguments error!\00"
@str.5 = [7 x i8] c"great.\00"
@str.6 = [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 %15
i32 110, label %6
i32 103, label %8
i32 108, label %10
i32 63, label %13
]
5: ; preds = %3, %13, %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.6, 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.5, 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
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %5
15: ; preds = %3
ret i32 0
}