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


x86 assembly (clang, -O0):
<test_get_job_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
lea    0xe9f(%rip),%rsi
lea    0xed4(%rip),%rdx
call   1070 <get_job_directory@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ae <test_get_job_directory+0x5e>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_job_directory>:
push   %rbp
push   %rbx
push   %rax
lea    0xea6(%rip),%rdi
lea    0xea4(%rip),%rsi
lea    0xed9(%rip),%rdx
call   1070 <get_job_directory@plt>
mov    %rax,%rbx
lea    0xe93(%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    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
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 = [53 x i8] c"/tmp/taskTracker/user/jobcache/job_200906101234_0001\00"
define void @test_get_job_directory() {
%1 = alloca i8*
%2 = alloca i32
%3 = 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))
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %5)
store i32 0, i32* %2
%7 = load i8*, i8** %1
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 -1, i32* %2
br label %11
11: ; preds = %10, %0
%12 = load i8*, i8** %1
%13 = call i32 @free(i8* %12)
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
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 = [53 x i8] c"/tmp/taskTracker/user/jobcache/job_200906101234_0001\00"
define void @test_get_job_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 @strcmp(i8* %2, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = tail call i32 @free(i8* %2)
%7 = zext i1 %5 to i32
%8 = tail call i32 @assert(i32 %7)
ret void
}