#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() {
  if (execl("/sbin/ifconfig", "/sbin/ifconfig", NULL) == -1) {
    if (execlp("ipconfig", "ipconfig", NULL) == -1) {
      fprintf(stderr, "Cannot run ipconfig: %s", strerror(errno));
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1060 <execl@plt>
cmp    $0xffffffff,%eax
jne    11c4 <main+0x84>
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1040 <execlp@plt>
cmp    $0xffffffff,%eax
jne    11bf <main+0x7f>
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rdx
lea    0xe6a(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cb <main+0x8b>
jmp    11c4 <main+0x84>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%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    119e <main+0x5e>
lea    0xeaf(%rip),%rdi
xor    %ebx,%ebx
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execlp@plt>
cmp    $0xffffffff,%eax
jne    119e <main+0x5e>
mov    0x2e68(%rip),%rax
mov    (%rax),%ebx
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe89(%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"
@stderr = global i32 0
@.str.2 = [24 x i8] c"Cannot run ipconfig: %s\00"
@errno = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = 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)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %13
4: ; preds = %0
%5 = call i32 @execlp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* null)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = call i8* @strerror(i32 %9)
%11 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %10)
store i32 1, i32* %1
br label %14
12: ; preds = %4
br label %13
13: ; preds = %12, %0
store i32 0, i32* %1
br label %14
14: ; preds = %13, %7
%15 = load i32, i32* %1
ret i32 %15
}

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