#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*/ printf(char *);
int /*<<< orphan*/ resolve_config_path(char *, char *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
void test_resolve_config_path() {
  printf("\nTesting resolve_config_path\n");
  if (strcmp(resolve_config_path("/bin/ls", NULL), "/bin/ls") != 0) {
    printf("FAIL: failed to resolve config_name on an absolute path name: "
           "/bin/ls\n");
    exit(1);
  }
  if (strcmp(resolve_config_path("../bin/ls", "/bin/ls"), "/bin/ls") != 0) {
    printf("FAIL: failed to resolve config_name on a relative path name: "
           "../bin/ls (relative to /bin/ls)");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<test_resolve_config_path>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    0xf10(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <resolve_config_path@plt>
mov    %eax,%edi
lea    0xefe(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     118e <test_resolve_config_path+0x4e>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xed0(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1030 <resolve_config_path@plt>
mov    %eax,%edi
lea    0xebd(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11cf <test_resolve_config_path+0x8f>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_resolve_config_path>:
push   %rbx
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5e(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <resolve_config_path@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11a4 <test_resolve_config_path+0x54>
lea    0xe7c(%rip),%rdi
lea    0xf37(%rip),%rbx
mov    %rbx,%rsi
call   1040 <resolve_config_path@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11ba <test_resolve_config_path+0x6a>
pop    %rbx
ret
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\0ATesting resolve_config_path\0A\00"
@.str.1 = [8 x i8] c"/bin/ls\00"
@.str.2 = [71 x i8] c"FAIL: failed to resolve config_name on an absolute path name: /bin/ls\0A\00"
@.str.3 = [10 x i8] c"../bin/ls\00"
@.str.4 = [93 x i8] c"FAIL: failed to resolve config_name on a relative path name: ../bin/ls (relative to /bin/ls)\00"
define void @test_resolve_config_path() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @resolve_config_path(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* null)
%3 = call i64 @strcmp(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = call i32 @resolve_config_path(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = call i64 @strcmp(i32 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"/bin/ls\00"
@.str.3 = [10 x i8] c"../bin/ls\00"
@.str.4 = [93 x i8] c"FAIL: failed to resolve config_name on a relative path name: ../bin/ls (relative to /bin/ls)\00"
@str = [29 x i8] c"\0ATesting resolve_config_path\00"
@str.5 = [70 x i8] c"FAIL: failed to resolve config_name on an absolute path name: /bin/ls\00"
define void @test_resolve_config_path() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @resolve_config_path(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* null)
%3 = tail call i64 @strcmp(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.5, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = tail call i32 @resolve_config_path(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i64 @strcmp(i32 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %8
ret void
}