#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void append_trans(char *trans, char *result, int initial) {
  if (trans) {
    if (initial) {
      strcpy(result, trans);
    } else {
      strcat(result, "-");
      strcat(result, trans);
    }
  } else {
    if (initial) {
      strcpy(result, "?");
    } else {
      strcat(result, "-?");
    }
  }
}


x86 assembly (clang, -O0):
<append_trans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117c <append_trans+0x5c>
cmpl   $0x0,-0x14(%rbp)
je     115a <append_trans+0x3a>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1177 <append_trans+0x57>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcat@plt>
jmp    11b0 <append_trans+0x90>
cmpl   $0x0,-0x14(%rbp)
je     119b <append_trans+0x7b>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ab <append_trans+0x8b>
mov    -0x10(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1040 <strcat@plt>
jmp    11b0 <append_trans+0x90>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_trans>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
test   %rdi,%rdi
je     113b <append_trans+0x1b>
mov    %rdi,%rbx
test   %edx,%edx
je     1155 <append_trans+0x35>
mov    %r14,%rdi
mov    %rbx,%rsi
jmp    1149 <append_trans+0x29>
test   %edx,%edx
je     116c <append_trans+0x4c>
lea    0xebd(%rip),%rsi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcpy@plt>
lea    0xea4(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
jmp    1176 <append_trans+0x56>
lea    0xe8f(%rip),%rsi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"?\00"
@.str.2 = [3 x i8] c"-?\00"
define void @append_trans(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %23
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8*, i8** %5
%14 = load i8*, i8** %4
%15 = call i32 @strcpy(i8* %13, i8* %14)
br label %22
16: ; preds = %9
%17 = load i8*, i8** %5
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = load i8*, i8** %5
%20 = load i8*, i8** %4
%21 = call i32 @strcat(i8* %19, i8* %20)
br label %22
22: ; preds = %16, %12
br label %33
23: ; preds = %3
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %5
%28 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
29: ; preds = %23
%30 = load i8*, i8** %5
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %29, %26
br label %33
33: ; preds = %32, %22
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"?\00"
@.str.2 = [3 x i8] c"-?\00"
define void @append_trans(i8* %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i32 %2, 0
br i1 %4, label %12, label %6
6: ; preds = %3
br i1 %5, label %9, label %7
7: ; preds = %6
%8 = tail call i32 @strcpy(i8* %1, i8* %0)
br label %17
9: ; preds = %6
%10 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @strcat(i8* %1, i8* %0)
br label %17
12: ; preds = %3
br i1 %5, label %15, label %13
13: ; preds = %12
%14 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
15: ; preds = %12
%16 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %13, %15, %7, %9
ret void
}