#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_log_dir(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
void test_get_job_log_dir() {
  char *logdir =
      (char *)get_job_log_dir("/tmp/testing", "job_200906101234_0001");
  printf("logdir obtained is %s\n", logdir);
  int ret = 0;
  if (strcmp(logdir, "/tmp/testing/userlogs/job_200906101234_0001") != 0) {
    ret = -1;
  }
  free(logdir);
  assert(ret == 0);
}


x86 assembly (clang, -O0):
<test_get_job_log_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1050 <get_job_log_dir@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11a7 <test_get_job_log_dir+0x57>
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   1070 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_job_log_dir>:
push   %rbp
push   %rbx
push   %rax
lea    0xea6(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1050 <get_job_log_dir@plt>
mov    %rax,%rbx
lea    0xe9d(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1060 <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    1070 <assert@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/tmp/testing\00"
@.str.1 = [22 x i8] c"job_200906101234_0001\00"
@.str.2 = [23 x i8] c"logdir obtained is %s\0A\00"
@.str.3 = [44 x i8] c"/tmp/testing/userlogs/job_200906101234_0001\00"
define void @test_get_job_log_dir() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i64 @get_job_log_dir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, 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 ([23 x i8], [23 x i8]* @.str.2, 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 ([44 x i8], [44 x i8]* @.str.3, 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 = [13 x i8] c"/tmp/testing\00"
@.str.1 = [22 x i8] c"job_200906101234_0001\00"
@.str.2 = [23 x i8] c"logdir obtained is %s\0A\00"
@.str.3 = [44 x i8] c"/tmp/testing/userlogs/job_200906101234_0001\00"
define void @test_get_job_log_dir() {
%1 = tail call i64 @get_job_log_dir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%4 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, 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
}