#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 stuf!\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    1185 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1180 <main+0x60>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1185 <main+0x65>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec1(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
jl     116d <main+0x3d>
mov    0x8(%rbx),%rdi
lea    0xebb(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    116d <main+0x3d>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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 = [10 x i8] c"Do stuf!\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 ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %13
br label %22
22: ; preds = %21, %3
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Got %d arguments.\0A\00"
@.str.1 = [10 x i8] c"--dostuff\00"
@str = [9 x i8] c"Do stuf!\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 %13
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 %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %6, %11, %3
ret i32 0
}