#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*/ printf(char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[], char *envp[]) {
  int i;
  printf("Got %d arguments.\n", argc);
  if (argc > 1) {
    if (!strcmp(argv[1], "--dostuff")) {
      printf("Do stuff!\n");
      return 1;
    }
  }
  printf("Don't do anything!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1191 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118c <main+0x6c>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <main+0x86>
jmp    1191 <main+0x71>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec0(%rip),%rdi
xor    %r14d,%r14d
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
jl     1165 <main+0x35>
mov    0x8(%rbx),%rdi
lea    0xeb7(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     116e <main+0x3e>
lea    0xeb1(%rip),%rdi
jmp    117b <main+0x4b>
mov    $0x1,%r14d
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Got %d arguments.\0A\00"
@.str.1 = [10 x i8] c"--dostuff\00"
@.str.2 = [11 x i8] c"Do stuff!\0A\00"
@.str.3 = [20 x i8] c"Don't do anything!\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %3
%14 = load i8**, i8*** %6
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %24
21: ; preds = %13
br label %22
22: ; preds = %21, %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %24
24: ; preds = %22, %19
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@.str = [19 x i8] c"Got %d arguments.\0A\00"
@.str.1 = [10 x i8] c"--dostuff\00"
@str = [19 x i8] c"Don't do anything!\00"
@str.4 = [10 x i8] c"Do stuff!\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %6, %3
br label %12
12: ; preds = %6, %11
%13 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0), %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, i64 0, i64 0), %6 ]
%14 = phi i32 [ 0, %11 ], [ 1, %6 ]
%15 = tail call i32 @puts(i8* dereferenceable(1) %13)
ret i32 %14
}