#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() {
  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>
cmp    $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>
cmp    $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    11ab <dialogNameOnly+0x7b>
xor    %eax,%eax
call   1040 <isDarwin@plt>
test   %rax,%rax
je     116f <dialogNameOnly+0x3f>
lea    0x2ef3(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcpy@plt>
test   %rax,%rax
je     116f <dialogNameOnly+0x3f>
lea    0x2edb(%rip),%rdi
call   1050 <detectPresence@plt>
test   %rax,%rax
jne    11ab <dialogNameOnly+0x7b>
lea    0x2eca(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcpy@plt>
test   %rax,%rax
je     1198 <dialogNameOnly+0x68>
lea    0x2eb2(%rip),%rdi
call   1050 <detectPresence@plt>
test   %rax,%rax
jne    11ab <dialogNameOnly+0x7b>
lea    0x2ea1(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2e8e(%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 %25
4: ; preds = %0
%5 = call i64 (...) @isDarwin()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %14
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 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %24
14: ; preds = %10, %7, %4
%15 = 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))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
br label %23
21: ; preds = %17, %14
%22 = 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 %23
23: ; preds = %21, %20
br label %24
24: ; preds = %23, %13
br label %25
25: ; preds = %24, %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 %20
3: ; preds = %0
%4 = tail call i64 (...) @isDarwin()
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, 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 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %9, %6, %3
%13 = 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))
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i64 @detectPresence(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15, %12
%19 = 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 %20
20: ; preds = %9, %15, %18, %0
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @dialogNameOnly.lDialogName, i64 0, i64 0)
}