#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, "bg:l:")) != -1) {
    switch (oc) {
    case 'b':
      printf("My name is zhangrongxiang.\n");
      break;
    case 'g':
      printf("Her name is null.\n");
      printf("Her name is %s.\n", optarg);
      break;
    case 'l':
      b_opt_arg = optarg;
      printf("Our love is %s\n", optarg);
      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     11f4 <main+0xd4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x62,%eax
je     118b <main+0x6b>
jmp    1169 <main+0x49>
mov    -0x24(%rbp),%eax
sub    $0x67,%eax
je     119e <main+0x7e>
jmp    117a <main+0x5a>
mov    -0x24(%rbp),%eax
sub    $0x6c,%eax
je     11c9 <main+0xa9>
jmp    11ef <main+0xcf>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <main+0xcf>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <main+0xcf>
mov    0x2e28(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e1a(%rip),%rax
mov    (%rax),%rsi
lea    0xe5e(%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    0xeb1(%rip),%r13
lea    0xebb(%rip),%r15
jmp    117a <main+0x4a>
xchg   %ax,%ax
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    (%r12),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x66,%eax
jle    11a0 <main+0x70>
cmp    $0x67,%eax
je     1160 <main+0x30>
cmp    $0x6c,%eax
jne    117a <main+0x4a>
mov    (%r12),%rsi
mov    %r15,%rdi
jmp    1173 <main+0x43>
nop
cmp    $0x62,%eax
jne    11b3 <main+0x83>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
jmp    117a <main+0x4a>
cmp    $0xffffffff,%eax
jne    117a <main+0x4a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"bg:l:\00"
@.str.1 = [28 x i8] c"My name is zhangrongxiang.\0A\00"
@.str.2 = [19 x i8] c"Her name is null.\0A\00"
@.str.3 = [17 x i8] c"Her name is %s.\0A\00"
@optarg = global i8* null
@.str.4 = [16 x i8] c"Our love 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 = %25, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([6 x i8], [6 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 98, label %15
i32 103, label %17
i32 108, label %21
]
15: ; preds = %13
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %25
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%19 = load i8*, i8** @optarg
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %25
21: ; preds = %13
%22 = load i8*, i8** @optarg
store i8* %22, i8** %7
%23 = load i8*, i8** @optarg
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %13, %21, %17, %15
br label %8
26: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"bg:l:\00"
@.str.3 = [17 x i8] c"Her name is %s.\0A\00"
@optarg = global i8* null
@.str.4 = [16 x i8] c"Our love is %s\0A\00"
@str = [18 x i8] c"Her name is null.\00"
@str.5 = [27 x i8] c"My name is zhangrongxiang.\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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %5 [
i32 -1, label %15
i32 98, label %6
i32 103, label %8
i32 108, label %12
]
5: ; preds = %3, %12, %8, %6
br label %3
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.5, i64 0, i64 0))
br label %5
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%10 = load i8*, i8** @optarg
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %5
12: ; preds = %3
%13 = load i8*, i8** @optarg
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %13)
br label %5
15: ; preds = %3
ret i32 0
}