#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*/ assert(int);
int /*<<< orphan*/ free(char *);
scalar_t__ get_attempt_directory(char *, char *);
scalar_t__ get_job_directory(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
void test_get_attempt_directory() {
  char *job_dir =
      (char *)get_job_directory("/tmp", "user", "job_200906101234_0001");
  printf("job_dir obtained is %s\n", job_dir);
  char *attempt_dir = (char *)get_attempt_directory(
      job_dir, "attempt_200906101234_0001_m_000000_0");
  printf("attempt_dir obtained is %s\n", attempt_dir);
  int ret = 0;
  if (strcmp(attempt_dir,
             "/tmp/taskTracker/user/jobcache/job_200906101234_0001/"
             "attempt_200906101234_0001_m_000000_0") != 0) {
    ret = -1;
  }
  free(job_dir);
  free(attempt_dir);
  assert(ret == 0);
}


x86 assembly (clang, -O0):
<test_get_attempt_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rdi
lea    0xe8f(%rip),%rsi
lea    0xe8d(%rip),%rdx
call   1080 <get_job_directory@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee8(%rip),%rsi
call   1070 <get_attempt_directory@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11e2 <test_get_attempt_directory+0x82>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_attempt_directory>:
push   %rbp
push   %r14
push   %rbx
lea    0xe95(%rip),%rdi
lea    0xe93(%rip),%rsi
lea    0xe91(%rip),%rdx
call   1080 <get_job_directory@plt>
mov    %rax,%r14
lea    0xe98(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xef2(%rip),%rsi
mov    %r14,%rdi
call   1070 <get_attempt_directory@plt>
mov    %rax,%rbx
lea    0xe8f(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <assert@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [5 x i8] c"user\00"
@.str.2 = [22 x i8] c"job_200906101234_0001\00"
@.str.3 = [24 x i8] c"job_dir obtained is %s\0A\00"
@.str.4 = [37 x i8] c"attempt_200906101234_0001_m_000000_0\00"
@.str.5 = [28 x i8] c"attempt_dir obtained is %s\0A\00"
@.str.6 = [90 x i8] c"/tmp/taskTracker/user/jobcache/job_200906101234_0001/attempt_200906101234_0001_m_000000_0\00"
define void @test_get_attempt_directory() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = call i64 @get_job_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 ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %1
%9 = call i64 @get_attempt_directory(i8* %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %11)
store i32 0, i32* %3
%13 = load i8*, i8** %2
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.6, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %0
store i32 -1, i32* %3
br label %17
17: ; preds = %16, %0
%18 = load i8*, i8** %1
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %2
%21 = call i32 @free(i8* %20)
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [5 x i8] c"user\00"
@.str.2 = [22 x i8] c"job_200906101234_0001\00"
@.str.3 = [24 x i8] c"job_dir obtained is %s\0A\00"
@.str.4 = [37 x i8] c"attempt_200906101234_0001_m_000000_0\00"
@.str.5 = [28 x i8] c"attempt_dir obtained is %s\0A\00"
@.str.6 = [90 x i8] c"/tmp/taskTracker/user/jobcache/job_200906101234_0001/attempt_200906101234_0001_m_000000_0\00"
define void @test_get_attempt_directory() {
%1 = tail call i64 @get_job_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 ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%4 = tail call i64 @get_attempt_directory(i8* %2, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%7 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.6, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = tail call i32 @free(i8* %2)
%10 = tail call i32 @free(i8* %5)
%11 = zext i1 %8 to i32
%12 = tail call i32 @assert(i32 %11)
ret void
}