#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*/ exit(int);
int /*<<< orphan*/ free(char *);
char *get_app_directory(char *, char *, char *);
char *get_container_launcher_file(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
void test_get_container_launcher_file() {
  char *expected_file = ("/tmp"
                         "/usercache/user/appcache/app_200906101234_0001"
                         "/launch_container.sh");
  char *app_dir = get_app_directory("/tmp", "user", "app_200906101234_0001");
  char *container_file = get_container_launcher_file(app_dir);
  if (strcmp(container_file, expected_file) != 0) {
    printf("failure to match expected container file %s vs %s\n",
           container_file, expected_file);
    exit(1);
  }
  free(app_dir);
  free(container_file);
}


x86 assembly (clang, -O0):
<test_get_container_launcher_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    0xecb(%rip),%rsi
lea    0xec9(%rip),%rdx
call   1050 <get_app_directory@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <get_container_launcher_file@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     11d3 <test_get_container_launcher_file+0x73>
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_container_launcher_file>:
push   %r14
push   %rbx
push   %rax
lea    0xedc(%rip),%rdi
lea    0xeda(%rip),%rsi
lea    0xed8(%rip),%rdx
call   1050 <get_app_directory@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <get_container_launcher_file@plt>
mov    %rax,%r14
lea    0xe6d(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    11b7 <test_get_container_launcher_file+0x57>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
lea    0xea9(%rip),%rdi
lea    0xe3b(%rip),%rdx
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [71 x i8] c"/tmp/usercache/user/appcache/app_200906101234_0001/launch_container.sh\00"
@.str.1 = [5 x i8] c"/tmp\00"
@.str.2 = [5 x i8] c"user\00"
@.str.3 = [22 x i8] c"app_200906101234_0001\00"
@.str.4 = [51 x i8] c"failure to match expected container file %s vs %s\0A\00"
define void @test_get_container_launcher_file() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
store i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = call i8* @get_app_directory(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @get_container_launcher_file(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = load i8*, i8** %1
%9 = call i64 @strcmp(i8* %7, i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %0
%12 = load i8*, i8** %3
%13 = load i8*, i8** %1
%14 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8* %12, i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = load i8*, i8** %2
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %3
%20 = call i32 @free(i8* %19)
ret void
}

LLVM IR (-O2):
@.str = [71 x i8] c"/tmp/usercache/user/appcache/app_200906101234_0001/launch_container.sh\00"
@.str.1 = [5 x i8] c"/tmp\00"
@.str.2 = [5 x i8] c"user\00"
@.str.3 = [22 x i8] c"app_200906101234_0001\00"
@.str.4 = [51 x i8] c"failure to match expected container file %s vs %s\0A\00"
define void @test_get_container_launcher_file() {
%1 = tail call i8* @get_app_directory(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i8* @get_container_launcher_file(i8* %1)
%3 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = tail call i32 @free(i8* %1)
%10 = tail call i32 @free(i8* %2)
ret void
}