#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 PATH_MAX;
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  printf("- GCC MOTIF -\n");
  char cmdi[PATH_MAX];
  if (argc == 2)
    if (strcmp(argv[1], "") != 0) {
      strncpy(cmdi, "", PATH_MAX);
      strncat(cmdi, " ", PATH_MAX - strlen(cmdi) - 1);
      strncat(cmdi,
              " gcc  -Wall -DLITTLE_ENDIAN -DINT_64 -O2 -I/usr/X11R6/include "
              "-L/usr/X11R6/lib -lm -lMrm -lXm -lXpm -lXext -lXt -lSM -lICE "
              "-lX11 \"",
              PATH_MAX - strlen(cmdi) - 1);
      strncat(cmdi, argv[1], PATH_MAX - strlen(cmdi) - 1);
      strncat(cmdi, "\" ", PATH_MAX - strlen(cmdi) - 1);
      strncat(cmdi, " -o a.out ", PATH_MAX - strlen(cmdi) - 1);
      system(cmdi);
      return 0;
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1060 <printf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    12fa <main+0x19a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe47(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     12f5 <main+0x195>
mov    -0x30(%rbp),%rdi
mov    0x2e0f(%rip),%rax
mov    (%rax),%edx
lea    0xe24(%rip),%rsi
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rdi
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
call   1040 <strlen@plt>
mov    -0x4c(%rbp),%edx
mov    -0x30(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
lea    0xe7c(%rip),%rsi
call   1070 <strncat@plt>
mov    -0x30(%rbp),%rdi
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
call   1040 <strlen@plt>
mov    -0x48(%rbp),%edx
mov    -0x30(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
lea    0xdcb(%rip),%rsi
call   1070 <strncat@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
call   1040 <strlen@plt>
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%rsi
mov    -0x30(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
call   1070 <strncat@plt>
mov    -0x30(%rbp),%rdi
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
call   1040 <strlen@plt>
mov    -0x38(%rbp),%edx
mov    -0x30(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
lea    0xdeb(%rip),%rsi
call   1070 <strncat@plt>
mov    -0x30(%rbp),%rdi
mov    0x2d39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
call   1040 <strlen@plt>
mov    -0x34(%rbp),%edx
mov    -0x30(%rbp),%rdi
sub    %eax,%edx
sub    $0x1,%edx
lea    0xdc1(%rip),%rsi
call   1070 <strncat@plt>
mov    -0x30(%rbp),%rdi
call   1050 <system@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x24(%rbp)
jmp    1308 <main+0x1a8>
jmp    12fa <main+0x19a>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%r15d
lea    0xf19(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e6c(%rip),%r12
mov    (%r12),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%r15d
jne    1286 <main+0x126>
mov    0x8(%r14),%rdi
lea    0xed7(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1286 <main+0x126>
mov    (%r12),%edx
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strncpy@plt>
mov    (%r12),%r15d
mov    %rbx,%rdi
call   1050 <strlen@plt>
not    %eax
add    %eax,%r15d
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1070 <strncat@plt>
mov    (%r12),%r15d
mov    %rbx,%rdi
call   1050 <strlen@plt>
not    %eax
add    %eax,%r15d
lea    0xdf6(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1070 <strncat@plt>
mov    0x8(%r14),%r14
mov    (%r12),%r15d
mov    %rbx,%rdi
call   1050 <strlen@plt>
not    %eax
add    %eax,%r15d
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1070 <strncat@plt>
mov    (%r12),%r14d
mov    %rbx,%rdi
call   1050 <strlen@plt>
not    %eax
add    %eax,%r14d
lea    0xe33(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
call   1070 <strncat@plt>
mov    (%r12),%r14d
mov    %rbx,%rdi
call   1050 <strlen@plt>
not    %eax
add    %eax,%r14d
lea    0xe13(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
call   1070 <strncat@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"- GCC MOTIF -\0A\00"
@PATH_MAX = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c" \00"
@.str.3 = [131 x i8] c" gcc -Wall -DLITTLE_ENDIAN -DINT_64 -O2 -I/usr/X11R6/include -L/usr/X11R6/lib -lm -lMrm -lXm -lXpm -lXext -lXt -lSM -lICE -lX11 \22\00"
@.str.4 = [3 x i8] c"\22 \00"
@.str.5 = [11 x i8] c" -o a.out \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @PATH_MAX
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %6
%13 = alloca i8, i64 %11
store i64 %11, i64* %7
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %55
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %54
22: ; preds = %16
%23 = load i32, i32* @PATH_MAX
%24 = call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load i32, i32* @PATH_MAX
%26 = call i32 @strlen(i8* %13)
%27 = sub nsw i32 %25, %26
%28 = sub nsw i32 %27, 1
%29 = call i32 @strncat(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = load i32, i32* @PATH_MAX
%31 = call i32 @strlen(i8* %13)
%32 = sub nsw i32 %30, %31
%33 = sub nsw i32 %32, 1
%34 = call i32 @strncat(i8* %13, i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = load i32, i32* @PATH_MAX
%39 = call i32 @strlen(i8* %13)
%40 = sub nsw i32 %38, %39
%41 = sub nsw i32 %40, 1
%42 = call i32 @strncat(i8* %13, i8* %37, i32 %41)
%43 = load i32, i32* @PATH_MAX
%44 = call i32 @strlen(i8* %13)
%45 = sub nsw i32 %43, %44
%46 = sub nsw i32 %45, 1
%47 = call i32 @strncat(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @PATH_MAX
%49 = call i32 @strlen(i8* %13)
%50 = sub nsw i32 %48, %49
%51 = sub nsw i32 %50, 1
%52 = call i32 @strncat(i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %51)
%53 = call i32 @system(i8* %13)
store i32 0, i32* %3
store i32 1, i32* %8
br label %56
54: ; preds = %16
br label %55
55: ; preds = %54, %2
store i32 0, i32* %3
store i32 1, i32* %8
br label %56
56: ; preds = %55, %22
%57 = load i8*, i8** %6
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c" \00"
@.str.3 = [131 x i8] c" gcc -Wall -DLITTLE_ENDIAN -DINT_64 -O2 -I/usr/X11R6/include -L/usr/X11R6/lib -lm -lMrm -lXm -lXpm -lXext -lXt -lSM -lICE -lX11 \22\00"
@.str.4 = [3 x i8] c"\22 \00"
@.str.5 = [11 x i8] c" -o a.out \00"
@str = [14 x i8] c"- GCC MOTIF -\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @PATH_MAX
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %43
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %43, label %13
13: ; preds = %8
%14 = load i32, i32* @PATH_MAX
%15 = call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @PATH_MAX
%17 = call i32 @strlen(i8* %6)
%18 = xor i32 %17, -1
%19 = add i32 %16, %18
%20 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* @PATH_MAX
%22 = call i32 @strlen(i8* %6)
%23 = xor i32 %22, -1
%24 = add i32 %21, %23
%25 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i8*, i8** %9
%27 = load i32, i32* @PATH_MAX
%28 = call i32 @strlen(i8* %6)
%29 = xor i32 %28, -1
%30 = add i32 %27, %29
%31 = call i32 @strncat(i8* %6, i8* %26, i32 %30)
%32 = load i32, i32* @PATH_MAX
%33 = call i32 @strlen(i8* %6)
%34 = xor i32 %33, -1
%35 = add i32 %32, %34
%36 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = load i32, i32* @PATH_MAX
%38 = call i32 @strlen(i8* %6)
%39 = xor i32 %38, -1
%40 = add i32 %37, %39
%41 = call i32 @strncat(i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = call i32 @system(i8* %6)
br label %43
43: ; preds = %2, %8, %13
ret i32 0
}