#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 */
scalar_t__ execlp(char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (execlp("ls", "myls", "-l", "-R", "/home", (char *)0) < 0)
    printf("error exec\n");
  printf("listing complete !!!\n");
  exit(0);
}


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)
lea    0xeb5(%rip),%rdi
lea    0xeac(%rip),%rsi
lea    0xeaa(%rip),%rdx
lea    0xea6(%rip),%rcx
lea    0xea2(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1050 <execlp@plt>
cmp    $0x0,%rax
jge    1189 <main+0x59>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeca(%rip),%rdi
lea    0xec1(%rip),%rsi
lea    0xebf(%rip),%rdx
lea    0xebb(%rip),%rcx
lea    0xeb7(%rip),%r8
xor    %r9d,%r9d
call   1050 <execlp@plt>
test   %rax,%rax
jns    116d <main+0x3d>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ls\00"
@.str.1 = [5 x i8] c"myls\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [3 x i8] c"-R\00"
@.str.4 = [6 x i8] c"/home\00"
@.str.5 = [12 x i8] c"error exec\0A\00"
@.str.6 = [22 x i8] c"listing complete !!!\0A\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 = call i64 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* null)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"ls\00"
@.str.1 = [5 x i8] c"myls\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [3 x i8] c"-R\00"
@.str.4 = [6 x i8] c"/home\00"
@str = [21 x i8] c"listing complete !!!\00"
@str.7 = [11 x i8] c"error exec\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* null)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 0)
unreachable
}