#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ increment_rank();
int /*<<< orphan*/ whoami(char *);
int main(int argc, char **argv) {
  if (atoi(argv[1]) > 0) {
    increment_rank();
    whoami("foo");
    execlp("bar", "bar", argv[1], NULL);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%rax
jle    119b <main+0x5b>
mov    $0x0,%al
call   1040 <increment_rank@plt>
lea    0xe85(%rip),%rdi
call   1030 <whoami@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe75(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1060 <execlp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
test   %rax,%rax
jle    117a <main+0x3a>
xor    %eax,%eax
call   1040 <increment_rank@plt>
lea    0xea0(%rip),%rdi
call   1030 <whoami@plt>
mov    0x8(%rbx),%rdx
lea    0xe94(%rip),%rdi
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1060 <execlp@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @atoi(i8* %8)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = call i32 (...) @increment_rank()
%13 = call i32 @whoami(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32* null)
br label %18
18: ; preds = %11, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoi(i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = tail call i32 (...) @increment_rank()
%9 = tail call i32 @whoami(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %3
%11 = tail call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32* null)
br label %12
12: ; preds = %7, %2
ret i32 0
}