#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*/ help_option();
int /*<<< orphan*/ strcmp(char const *, char *);
int /*<<< orphan*/ version_option();
do_gnu_stuff(const char **argv) {
  const char **current = argv;
  while (*current) {
    if (!strcmp(*current, "--version"))
      version_option();
    if (!strcmp(*current, "--help"))
      help_option();
    current++;
  }
}


x86 assembly (clang, -O0):
<do_gnu_stuff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11a9 <do_gnu_stuff+0x79>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1175 <do_gnu_stuff+0x45>
mov    $0x0,%al
call   1050 <version_option@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1198 <do_gnu_stuff+0x68>
mov    $0x0,%al
call   1030 <help_option@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1144 <do_gnu_stuff+0x14>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_gnu_stuff>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    (%rdi),%rbx
test   %rbx,%rbx
je     11a0 <do_gnu_stuff+0x70>
mov    %rdi,%r12
add    $0x8,%r12
lea    0xeb2(%rip),%r14
lea    0xeb5(%rip),%r15
jmp    116d <do_gnu_stuff+0x3d>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%rbx
add    $0x8,%r12
test   %rbx,%rbx
je     11a0 <do_gnu_stuff+0x70>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1188 <do_gnu_stuff+0x58>
xor    %eax,%eax
call   1050 <version_option@plt>
mov    -0x8(%r12),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1160 <do_gnu_stuff+0x30>
xor    %eax,%eax
call   1030 <help_option@plt>
jmp    1160 <do_gnu_stuff+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"--version\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @do_gnu_stuff(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8**
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
store i8** %5, i8*** %4
br label %6
6: ; preds = %24, %1
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %27
10: ; preds = %6
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = call i32 (...) @version_option()
br label %17
17: ; preds = %15, %10
%18 = load i8**, i8*** %4
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = call i32 (...) @help_option()
br label %24
24: ; preds = %22, %17
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %4
br label %6
27: ; preds = %6
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@.str = [10 x i8] c"--version\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @do_gnu_stuff(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %22, label %4
4: ; preds = %1, %18
%5 = phi i8* [ %20, %18 ], [ %2, %1 ]
%6 = phi i8** [ %19, %18 ], [ %0, %1 ]
%7 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i32 (...) @version_option()
%11 = load i8*, i8** %6
br label %12
12: ; preds = %9, %4
%13 = phi i8* [ %11, %9 ], [ %5, %4 ]
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = tail call i32 (...) @help_option()
br label %18
18: ; preds = %16, %12
%19 = getelementptr inbounds i8*, i8** %6, i64 1
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %4
22: ; preds = %18, %1
ret i32 undef
}