#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 *, int /*<<< orphan*/ *);
int execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char const *argv[]) {
  if (execl("/sbin/ifconfig", "/sbin/ifconfig", NULL) == -1)
    if (execlp("ipconfig", "ipcofig", NULL) == -1) {
      fprintf(stderr, "Cannot run ipconfig: %s\n", strerror(errno));
      return 1;
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1060 <execl@plt>
cmp    $0xffffffff,%eax
jne    11cf <main+0x8f>
lea    0xe96(%rip),%rdi
lea    0xe98(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <execlp@plt>
cmp    $0xffffffff,%eax
jne    11ca <main+0x8a>
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0xe67(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d6 <main+0x96>
jmp    11cf <main+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
xor    %ebx,%ebx
mov    %rdi,%rsi
xor    %edx,%edx
call   1060 <execl@plt>
cmp    $0xffffffff,%eax
jne    11a2 <main+0x62>
lea    0xeaf(%rip),%rdi
lea    0xeb1(%rip),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1040 <execlp@plt>
cmp    $0xffffffff,%eax
jne    11a2 <main+0x62>
mov    0x2e64(%rip),%rax
mov    (%rax),%ebx
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe8d(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/sbin/ifconfig\00"
@.str.1 = [9 x i8] c"ipconfig\00"
@.str.2 = [8 x i8] c"ipcofig\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"Cannot run ipconfig: %s\0A\00"
@errno = global i32 0
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 i32 @execl(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* null)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = call i32 @execlp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* null)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %18
16: ; preds = %8
br label %17
17: ; preds = %16, %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [15 x i8] c"/sbin/ifconfig\00"
@.str.1 = [9 x i8] c"ipconfig\00"
@.str.2 = [8 x i8] c"ipcofig\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"Cannot run ipconfig: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @execl(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = tail call i32 @execlp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* null)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = tail call i8* @strerror(i32 %10)
%12 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %2, %5, %8
%14 = phi i32 [ 1, %8 ], [ 0, %5 ], [ 0, %2 ]
ret i32 %14
}