#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*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getexecname();
int isaexec(char const *, char **, char **);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[], char *envv[]) {
  int rc = 0;
  const char *pszExec = getexecname();
  if (!pszExec) {
    fprintf(stderr, "Failed to get executable name.\n");
    return -1;
  }
  rc = isaexec(pszExec, argv, envv);
  if (rc == -1)
    fprintf(stderr, "Failed to find/execute ISA specific executable for %s\n",
            pszExec);
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <getexecname@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    118a <main+0x5a>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <main+0x99>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <isaexec@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11c3 <main+0x93>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
xor    %eax,%eax
call   1030 <getexecname@plt>
test   %rax,%rax
je     1179 <main+0x49>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <isaexec@plt>
cmp    $0xffffffff,%eax
jne    1195 <main+0x65>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1190 <main+0x60>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Failed to get executable name.\0A\00"
@.str.1 = [55 x i8] c"Failed to find/execute ISA specific executable for %s\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %8
%10 = call i8* (...) @getexecname()
store i8* %10, i8** %9
%11 = load i8*, i8** %9
%12 = icmp ne i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %29
16: ; preds = %3
%17 = load i8*, i8** %9
%18 = load i8**, i8*** %6
%19 = load i8**, i8*** %7
%20 = call i32 @isaexec(i8* %17, i8** %18, i8** %19)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %27
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %9
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %23, %16
%28 = load i32, i32* %8
store i32 %28, i32* %4
br label %29
29: ; preds = %27, %13
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Failed to get executable name.\0A\00"
@.str.1 = [55 x i8] c"Failed to find/execute ISA specific executable for %s\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = tail call i8* (...) @getexecname()
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %15
9: ; preds = %3
%10 = tail call i32 @isaexec(i8* %4, i8** %1, i8** %2)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %15
15: ; preds = %9, %12, %6
%16 = phi i32 [ -1, %6 ], [ -1, %12 ], [ %10, %9 ]
ret i32 %16
}