#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*/ errno;
int execl(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void my_execl() {
  if (execl("/bin/ls", "ls", "-l", NULL) == -1) {
    fprintf(stderr, "error : %s\n", strerror(errno));
  }
}


x86 assembly (clang, -O0):
<my_execl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebf(%rip),%rsi
lea    0xebb(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <execl@plt>
cmp    $0xffffffff,%eax
jne    118b <my_execl+0x5b>
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xe85(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_execl>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec6(%rip),%rsi
lea    0xec2(%rip),%rdx
xor    %ecx,%ecx
call   1050 <execl@plt>
cmp    $0xffffffff,%eax
je     1154 <my_execl+0x24>
pop    %rbx
ret
mov    0x2e85(%rip),%rax
mov    (%rax),%ebx
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xe99(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/ls\00"
@.str.1 = [3 x i8] c"ls\00"
@.str.2 = [3 x i8] c"-l\00"
@stderr = global i32 0
@.str.3 = [12 x i8] c"error : %s\0A\00"
@errno = global i32 0
define void @my_execl() {
%1 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* null)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/ls\00"
@.str.1 = [3 x i8] c"ls\00"
@.str.2 = [3 x i8] c"-l\00"
@stderr = global i32 0
@.str.3 = [12 x i8] c"error : %s\0A\00"
@errno = global i32 0
define void @my_execl() {
%1 = tail call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* null)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %8
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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %3, %0
ret void
}