#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ ftsh_error(int, int, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int builtin_exec(int line, int argc, char **argv, time_t stoptime) {
  execvp(argv[1], &argv[1]);
  ftsh_error(10, line, "exec: %s failed: %s", argv[1], strerror(errno));
  return 0;
}


x86 assembly (clang, -O0):
<builtin_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <execvp@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    %eax,%r8d
mov    $0xa,%edi
lea    0xe70(%rip),%rdx
call   1030 <ftsh_error@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_exec>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
lea    0x8(%rdx),%rsi
mov    0x8(%rdx),%rdi
call   1040 <execvp@plt>
mov    0x8(%rbx),%rbx
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea2(%rip),%rdx
mov    $0xa,%edi
mov    %ebp,%esi
mov    %rbx,%rcx
mov    %eax,%r8d
call   1030 <ftsh_error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"exec: %s failed: %s\00"
@errno = global i32 0
define i32 @builtin_exec(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load i8**, i8*** %7
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %7
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = call i32 @execvp(i8* %11, i8** %13)
%15 = load i32, i32* %5
%16 = load i8**, i8*** %7
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i32, i32* @errno
%20 = call i32 @strerror(i32 %19)
%21 = call i32 @ftsh_error(i32 10, i32 %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"exec: %s failed: %s\00"
@errno = global i32 0
define i32 @builtin_exec(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = getelementptr inbounds i8*, i8** %2, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @execvp(i8* %6, i8** %5)
%8 = load i8*, i8** %5
%9 = load i32, i32* @errno
%10 = tail call i32 @strerror(i32 %9)
%11 = tail call i32 @ftsh_error(i32 10, i32 %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %10)
ret i32 0
}