#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*/ EXIT_FAILURE;
int /*<<< orphan*/ errno;
int execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(void) {
  if (execlp("./hello", "hello", NULL) == -1)
    do {
      fprintf(stderr, "[%s][%d]:%s %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/heads/"
              "master/apue/day06/fcntl.c",
              20, "execvp", strerror(errno));
      exit(EXIT_FAILURE);
    } while (0);
  printf("exit!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe95(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <execlp@plt>
cmp    $0xffffffff,%eax
jne    11d1 <main+0x81>
jmp    1184 <main+0x34>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%r9
lea    0xe5d(%rip),%rsi
lea    0xe66(%rip),%rdx
mov    $0x14,%ecx
lea    0xeee(%rip),%r8
call   1040 <fprintf@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rdi
lea    0xea3(%rip),%rsi
xor    %edx,%edx
call   1060 <execlp@plt>
cmp    $0xffffffff,%eax
je     117b <main+0x2b>
lea    0xf41(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e5e(%rip),%rax
mov    (%rax),%ebx
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe6f(%rip),%rsi
lea    0xe78(%rip),%rdx
lea    0xf05(%rip),%r8
mov    %ebx,%edi
mov    $0x14,%ecx
mov    %rax,%r9
call   1040 <fprintf@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"./hello\00"
@.str.1 = [6 x i8] c"hello\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"[%s][%d]:%s %s\0A\00"
@.str.3 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/heads/master/apue/day06/fcntl.c\00"
@.str.4 = [7 x i8] c"execvp\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.5 = [7 x i8] c"exit!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @execlp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* null)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %13
4: ; preds = %0
br label %5
5: ; preds = %4
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = call i8* @strerror(i32 %7)
%9 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.3, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; No predecessors!
br label %13
13: ; preds = %12, %0
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"./hello\00"
@.str.1 = [6 x i8] c"hello\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"[%s][%d]:%s %s\0A\00"
@.str.3 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/heads/master/apue/day06/fcntl.c\00"
@.str.4 = [7 x i8] c"execvp\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@str = [6 x i8] c"exit!\00"
define i32 @main() {
%1 = tail call i32 @execlp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* null)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.3, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}