#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*/ free(char *);
char *get_attempt_work_directory(char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
void test_get_attempt_directory() {
  char *attempt_dir =
      get_attempt_work_directory("/tmp", "owen", "job_1", "attempt_1");
  char *expected = "/tmp/taskTracker/owen/jobcache/job_1/attempt_1/work";
  if (strcmp(attempt_dir, expected) != 0) {
    printf("Fail get_attempt_work_directory got %s expected %s\n", attempt_dir,
           expected);
  }
  free(attempt_dir);
}


x86 assembly (clang, -O0):
<test_get_attempt_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeaf(%rip),%rsi
lea    0xead(%rip),%rdx
lea    0xeac(%rip),%rcx
call   1040 <get_attempt_work_directory@plt>
mov    %rax,-0x8(%rbp)
lea    0xea6(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11a3 <test_get_attempt_directory+0x63>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_attempt_directory>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xeb6(%rip),%rsi
lea    0xeb4(%rip),%rdx
lea    0xeb3(%rip),%rcx
call   1040 <get_attempt_work_directory@plt>
mov    %rax,%rbx
lea    0xeae(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     118f <test_get_attempt_directory+0x4f>
lea    0xece(%rip),%rdi
lea    0xe93(%rip),%rdx
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [5 x i8] c"owen\00"
@.str.2 = [6 x i8] c"job_1\00"
@.str.3 = [10 x i8] c"attempt_1\00"
@.str.4 = [52 x i8] c"/tmp/taskTracker/owen/jobcache/job_1/attempt_1/work\00"
@.str.5 = [52 x i8] c"Fail get_attempt_work_directory got %s expected %s\0A\00"
define void @test_get_attempt_directory() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @get_attempt_work_directory(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store i8* %3, i8** %1
store i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %1
%5 = load i8*, i8** %2
%6 = call i64 @strcmp(i8* %4, i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* %9, i8* %10)
br label %12
12: ; preds = %8, %0
%13 = load i8*, i8** %1
%14 = call i32 @free(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [5 x i8] c"owen\00"
@.str.2 = [6 x i8] c"job_1\00"
@.str.3 = [10 x i8] c"attempt_1\00"
@.str.4 = [52 x i8] c"/tmp/taskTracker/owen/jobcache/job_1/attempt_1/work\00"
@.str.5 = [52 x i8] c"Fail get_attempt_work_directory got %s expected %s\0A\00"
define void @test_get_attempt_directory() {
%1 = tail call i8* @get_attempt_work_directory(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = tail call i32 @free(i8* %1)
ret void
}