#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*/ get_output_name(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main() {
  char path[] = "Hi.txt";
  char out[255];
  get_output_name(path, out);
  printf("Path: %s\nOutput: %s\n", path, out);
  if (strcmp(out, "Hi_STMP_OUT.txt") != 0) {
    return -1;
  }
  printf("--------------\n");
  char path2[] = "test/Hi.txt";
  get_output_name(path2, out);
  printf("Path: %s\nOutput: %s\n", path, out);
  if (strcmp(out, "test/Hi_STMP_OUT.txt") != 0) {
    return -1;
  }
  printf("--------------\n");
  char path3[] = "lol-funny";
  get_output_name(path3, out);
  printf("Path: %s\nOutput: %s\n", path, out);
  if (strcmp(out, "lol-funny_STMP_OUT") != 0) {
    return -1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xee2(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xedc(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xed4(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xb(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1050 <get_output_name@plt>
lea    -0xb(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11b1 <main+0x81>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a8 <main+0x178>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe5f(%rip),%rax
mov    %rax,-0x11c(%rbp)
mov    0xe5a(%rip),%eax
mov    %eax,-0x114(%rbp)
lea    -0x11c(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1050 <get_output_name@plt>
lea    -0xb(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122e <main+0xfe>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a8 <main+0x178>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe03(%rip),%rax
mov    %rax,-0x126(%rbp)
mov    0xdfd(%rip),%ax
mov    %ax,-0x11e(%rbp)
lea    -0x126(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1050 <get_output_name@plt>
lea    -0xb(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     12a8 <main+0x178>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x138,%rsp
movl   $0x747874,0xb(%rsp)
movl   $0x742e6948,0x8(%rsp)
74
lea    0x8(%rsp),%r14
lea    0x30(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <get_output_name@plt>
lea    0xe8a(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1268 <main+0x128>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
movabs $0x2e69482f74736574,%rax
48 69 2e
mov    %rax,0x20(%rsp)
movl   $0x747874,0x28(%rsp)
lea    0x20(%rsp),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <get_output_name@plt>
lea    0xe21(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1268 <main+0x128>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
movabs $0x6e6e75662d6c6f6c,%rax
75 6e 6e
mov    %rax,0x10(%rsp)
movw   $0x79,0x18(%rsp)
lea    0x10(%rsp),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <get_output_name@plt>
lea    0xdbb(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde5(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
neg    %rax
sbb    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.path = [7 x i8] c"Hi.txt\00"
@.str = [21 x i8] c"Path: %s\0AOutput: %s\0A\00"
@.str.1 = [16 x i8] c"Hi_STMP_OUT.txt\00"
@.str.2 = [16 x i8] c"--------------\0A\00"
@__const.main.path2 = [12 x i8] c"test/Hi.txt\00"
@.str.3 = [21 x i8] c"test/Hi_STMP_OUT.txt\00"
@__const.main.path3 = [10 x i8] c"lol-funny\00"
@.str.4 = [19 x i8] c"lol-funny_STMP_OUT\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [255 x i8]
%4 = alloca [12 x i8]
%5 = alloca [10 x i8]
store i32 0, i32* %1
%6 = bitcast [7 x i8]* %2 to i8*
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%9 = call i32 @get_output_name(i8* %7, i8* %8)
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %0
store i32 -1, i32* %1
br label %43
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%19 = bitcast [12 x i8]* %4 to i8*
%20 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%22 = call i32 @get_output_name(i8* %20, i8* %21)
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24)
%26 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %17
store i32 -1, i32* %1
br label %43
30: ; preds = %17
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%32 = bitcast [10 x i8]* %5 to i8*
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%34 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%35 = call i32 @get_output_name(i8* %33, i8* %34)
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%37 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %36, i8* %37)
%39 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %30
store i32 -1, i32* %1
br label %43
43: ; preds = %16, %29, %42, %30
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@__const.main.path = [7 x i8] c"Hi.txt\00"
@.str = [21 x i8] c"Path: %s\0AOutput: %s\0A\00"
@.str.1 = [16 x i8] c"Hi_STMP_OUT.txt\00"
@__const.main.path2 = [12 x i8] c"test/Hi.txt\00"
@.str.3 = [21 x i8] c"test/Hi_STMP_OUT.txt\00"
@__const.main.path3 = [10 x i8] c"lol-funny\00"
@.str.4 = [19 x i8] c"lol-funny_STMP_OUT\00"
@str.5 = [15 x i8] c"--------------\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [255 x i8]
%3 = alloca [12 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%7 = call i32 @get_output_name(i8* %5, i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%9 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%14 = call i32 @get_output_name(i8* %13, i8* %6)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%16 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %11
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%21 = call i32 @get_output_name(i8* %20, i8* %6)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%23 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
%25 = sext i1 %24 to i32
br label %26
26: ; preds = %11, %18
%27 = phi i32 [ %25, %18 ], [ -1, %11 ]
br label %28
28: ; preds = %0, %26
%29 = phi i32 [ %27, %26 ], [ -1, %0 ]
ret i32 %29
}