#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__ detectPresence(char *);
scalar_t__ isDarwin();
scalar_t__ *strcpy(char *, char *);
char const *dialogNameOnly(void) {
  static char lDialogName[128] = "*";
  if (lDialogName[0] == '*') {
    if (isDarwin() && *strcpy(lDialogName, "/opt/local/bin/dialog") &&
        detectPresence(lDialogName)) {
    } else if (*strcpy(lDialogName, "dialog") && detectPresence(lDialogName)) {
    } else {
      strcpy(lDialogName, "");
    }
  }
  return lDialogName;
}


x86 assembly (clang, -O0):
<dialogNameOnly>:
push   %rbp
mov    %rsp,%rbp
movsbl 0x2f05(%rip),%eax
cmp    $0x2a,%eax
jne    11e2 <dialogNameOnly+0xb2>
mov    $0x0,%al
call   1040 <isDarwin@plt>
cmp    $0x0,%rax
je     118d <dialogNameOnly+0x5d>
lea    0x2ee4(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <strcpy@plt>
cmpq   $0x0,(%rax)
je     118d <dialogNameOnly+0x5d>
lea    0x2ec7(%rip),%rdi
call   1050 <detectPresence@plt>
cmp    $0x0,%rax
je     118d <dialogNameOnly+0x5d>
jmp    11dd <dialogNameOnly+0xad>
lea    0x2eac(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcpy@plt>
cmpq   $0x0,(%rax)
je     11c5 <dialogNameOnly+0x95>
lea    0x2e8f(%rip),%rdi
call   1050 <detectPresence@plt>
cmp    $0x0,%rax
je     11c5 <dialogNameOnly+0x95>
jmp    11d8 <dialogNameOnly+0xa8>
lea    0x2e74(%rip),%rdi
lea    0xe42(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11dd <dialogNameOnly+0xad>
jmp    11e2 <dialogNameOnly+0xb2>
lea    0x2e57(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dialogNameOnly>:
push   %rax
cmpb   $0x2a,0x2f08(%rip)
jne    11ad <dialogNameOnly+0x7d>
xor    %eax,%eax
call   1040 <isDarwin@plt>
test   %rax,%rax
je     1170 <dialogNameOnly+0x40>
lea    0x2ef3(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcpy@plt>
cmpq   $0x0,(%rax)
je     1170 <dialogNameOnly+0x40>
lea    0x2eda(%rip),%rdi
call   1050 <detectPresence@plt>
test   %rax,%rax
jne    11ad <dialogNameOnly+0x7d>
lea    0x2ec9(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcpy@plt>
cmpq   $0x0,(%rax)
je     119a <dialogNameOnly+0x6a>
lea    0x2eb0(%rip),%rdi
call   1050 <detectPresence@plt>
test   %rax,%rax
jne    11ad <dialogNameOnly+0x7d>
lea    0x2e9f(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2e8c(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@dialogNameOnly.lDialogName = internal global [128 x i8] c"*\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [22 x i8] c"/opt/local/bin/dialog\00"
@.str.1 = [7 x i8] c"dialog\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @dialogNameOnly() {
%1 = load i8, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0)
%2 = sext i8 %1 to i32
%3 = icmp eq i32 %2, 42
br i1 %3, label %4, label %27
4: ; preds = %0
%5 = call i64 (...) @isDarwin()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = call i64* @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = load i64, i64* %8
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %26
15: ; preds = %11, %7, %4
%16 = call i64* @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = load i64, i64* %16
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
br label %25
23: ; preds = %19, %15
%24 = call i64* @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %22
br label %26
26: ; preds = %25, %14
br label %27
27: ; preds = %26, %0
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0)
}

LLVM IR (-O2):
@dialogNameOnly.lDialogName = internal global [128 x i8] c"*\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [22 x i8] c"/opt/local/bin/dialog\00"
@.str.1 = [7 x i8] c"dialog\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @dialogNameOnly() {
%1 = load i8, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0)
%2 = icmp eq i8 %1, 42
br i1 %2, label %3, label %22
3: ; preds = %0
%4 = tail call i64 (...) @isDarwin()
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i64* @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = tail call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %10, %6, %3
%14 = tail call i64* @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = load i64, i64* %14
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %13
%18 = tail call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17, %13
%21 = tail call i64* @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %10, %17, %20, %0
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0)
}