#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*/ execvp(char *, char **);
scalar_t__ getenv(char *);
int /*<<< orphan*/ setenv(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  char wrapped_cmd[1024];
  if (getenv("DISPLAY")) {
    setenv("XDIALOG_HIGH_DIALOG_COMPAT", "true", 0);
    setenv("XDIALOG_FORCE_AUTOSIZE", "true", 0);
    execvp("Xdialog", argv);
  } else {
    strcpy(wrapped_cmd, argv[0]);
    strcat(wrapped_cmd, ".wrapped");
    execvp(wrapped_cmd, argv);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11be <main+0x6e>
lea    0xe82(%rip),%rdi
lea    0xe96(%rip),%rsi
xor    %edx,%edx
call   1050 <setenv@plt>
lea    0xe8d(%rip),%rdi
lea    0xe81(%rip),%rsi
xor    %edx,%edx
call   1050 <setenv@plt>
mov    -0x10(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1060 <execvp@plt>
jmp    11f4 <main+0xa4>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x410(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <execvp@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
lea    0xe9c(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11a0 <main+0x50>
lea    0xe93(%rip),%rdi
lea    0xea7(%rip),%r14
mov    %r14,%rsi
xor    %edx,%edx
call   1050 <setenv@plt>
lea    0xe9b(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1050 <setenv@plt>
lea    0xea1(%rip),%rdi
jmp    11c0 <main+0x70>
mov    (%rbx),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0xe92(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <execvp@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"DISPLAY\00"
@.str.1 = [27 x i8] c"XDIALOG_HIGH_DIALOG_COMPAT\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [23 x i8] c"XDIALOG_FORCE_AUTOSIZE\00"
@.str.4 = [8 x i8] c"Xdialog\00"
@.str.5 = [9 x i8] c".wrapped\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = call i32 @setenv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
%11 = call i32 @setenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
%12 = load i8**, i8*** %5
%13 = call i32 @execvp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %12)
br label %25
14: ; preds = %2
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @strcpy(i8* %15, i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%23 = load i8**, i8*** %5
%24 = call i32 @execvp(i8* %22, i8** %23)
br label %25
25: ; preds = %14, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"DISPLAY\00"
@.str.1 = [27 x i8] c"XDIALOG_HIGH_DIALOG_COMPAT\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [23 x i8] c"XDIALOG_FORCE_AUTOSIZE\00"
@.str.4 = [8 x i8] c"Xdialog\00"
@.str.5 = [9 x i8] c".wrapped\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = tail call i32 @setenv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
%9 = tail call i32 @setenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
%10 = tail call i32 @execvp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %1)
br label %16
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = call i32 @strcpy(i8* %4, i8* %12)
%14 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @execvp(i8* %4, i8** %1)
br label %16
16: ; preds = %11, %7
ret i32 0
}