#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*/ SIGHUP;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s commande [arg] [arg] ...\n", argv[0]);
    exit(1);
  }
  if (signal(SIGHUP, SIG_IGN) == SIG_ERR) {
    perror("signal");
    exit(1);
  }
  execvp(argv[1], argv + 1);
  perror("execvp");
  exit(1);
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    1196 <main+0x46>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2e14(%rip),%rcx
cmp    (%rcx),%rax
jne    11d3 <main+0x83>
lea    0xe60(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1060 <execvp@plt>
lea    0xe3c(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     117b <main+0x2b>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    0x2e55(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2e2f(%rip),%rcx
cmp    (%rcx),%rax
jne    11a7 <main+0x57>
lea    0xe7f(%rip),%rdi
jmp    11be <main+0x6e>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
mov    %rbx,%rsi
call   1060 <execvp@plt>
lea    0xe6d(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s commande [arg] [arg] ...\0A\00"
@SIGHUP = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str.1 = [7 x i8] c"signal\00"
@.str.2 = [7 x i8] c"execvp\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 i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i32, i32* @SIGHUP
%17 = load i32, i32* @SIG_IGN
%18 = call i64 @signal(i32 %16, i32 %17)
%19 = load i64, i64* @SIG_ERR
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %15
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = call i32 @execvp(i8* %27, i8** %29)
%31 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s commande [arg] [arg] ...\0A\00"
@SIGHUP = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str.1 = [7 x i8] c"signal\00"
@.str.2 = [7 x i8] c"execvp\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = load i32, i32* @SIGHUP
%11 = load i32, i32* @SIG_IGN
%12 = tail call i64 @signal(i32 %10, i32 %11)
%13 = load i64, i64* @SIG_ERR
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32 @execvp(i8* %20, i8** %19)
%22 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
}