#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 execvp(char *, char **);
int /*<<< orphan*/ help(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
    help(stderr, argv[0]);
    return 0;
  }
  if (argc < 3) {
    help(stderr, argv[0]);
    return 1;
  }
  int r = execvp(argv[1], argv + 2);
  if (r == -1) {
    perror("execvp");
    return 127;
  }
  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)
cmpl   $0x2,-0x8(%rbp)
jne    11bb <main+0x7b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     119a <main+0x5a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe77(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11bb <main+0x7b>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1227 <main+0xe7>
cmpl   $0x3,-0x8(%rbp)
jge    11e6 <main+0xa6>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <help@plt>
movl   $0x1,-0x4(%rbp)
jmp    1227 <main+0xe7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1060 <execvp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1220 <main+0xe0>
lea    0xdfb(%rip),%rdi
call   1040 <perror@plt>
movl   $0x7f,-0x4(%rbp)
jmp    1227 <main+0xe7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    118b <main+0x4b>
mov    0x8(%rbx),%r14
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1176 <main+0x36>
lea    0xe99(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    118d <main+0x4d>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rsi
call   1050 <help@plt>
xor    %eax,%eax
jmp    11be <main+0x7e>
jg     11a5 <main+0x65>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rsi
call   1050 <help@plt>
mov    $0x1,%eax
jmp    11be <main+0x7e>
mov    0x8(%rbx),%rdi
add    $0x10,%rbx
mov    %rbx,%rsi
call   1060 <execvp@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     11c6 <main+0x86>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe3d(%rip),%rdi
call   1040 <perror@plt>
mov    $0x7f,%eax
jmp    11be <main+0x7e>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.2 = [7 x i8] c"execvp\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %27
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %15, %9
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @help(i32 %22, i8* %25)
store i32 0, i32* %3
br label %48
27: ; preds = %15, %2
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @help(i32 %31, i8* %34)
store i32 1, i32* %3
br label %48
36: ; preds = %27
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = call i32 @execvp(i8* %39, i8** %41)
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %47
45: ; preds = %36
%46 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 127, i32* %3
br label %48
47: ; preds = %36
store i32 0, i32* %3
br label %48
48: ; preds = %47, %45, %30, %21
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.2 = [7 x i8] c"execvp\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9, %4
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 @help(i32 %13, i8* %14)
br label %30
16: ; preds = %2
%17 = icmp slt i32 %0, 3
br i1 %17, label %18, label %22
18: ; preds = %9, %16
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = tail call i32 @help(i32 %19, i8* %20)
br label %30
22: ; preds = %16
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = tail call i32 @execvp(i8* %24, i8** %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28, %22, %18, %12
%31 = phi i32 [ 1, %18 ], [ 0, %12 ], [ 127, %28 ], [ 0, %22 ]
ret i32 %31
}