#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 */
scalar_t__ check_configuration_permissions(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void test_check_configuration_permissions() {
  printf("\nTesting check_configuration_permissions\n");
  if (check_configuration_permissions("/etc/passwd") != 0) {
    printf("FAIL: failed permission check on /etc/passwd\n");
    exit(1);
  }
  if (check_configuration_permissions("/tmp/test-container-executor") == 0) {
    printf("FAIL: failed permission check on %s\n",
           "/tmp/test-container-executor");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<test_check_configuration_permissions>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <check_configuration_permissions@plt>
cmp    $0x0,%rax
je     1170 <test_check_configuration_permissions+0x40>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xeed(%rip),%rdi
call   1030 <check_configuration_permissions@plt>
cmp    $0x0,%rax
jne    11a5 <test_check_configuration_permissions+0x75>
lea    0xef4(%rip),%rdi
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_check_configuration_permissions>:
push   %rax
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xf38(%rip),%rdi
call   1040 <check_configuration_permissions@plt>
test   %rax,%rax
jne    1171 <test_check_configuration_permissions+0x31>
lea    0xe9b(%rip),%rdi
call   1040 <check_configuration_permissions@plt>
test   %rax,%rax
je     1187 <test_check_configuration_permissions+0x47>
pop    %rax
ret
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xe8f(%rip),%rdi
lea    0xe6b(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"\0ATesting check_configuration_permissions\0A\00"
@.str.1 = [12 x i8] c"/etc/passwd\00"
@.str.2 = [46 x i8] c"FAIL: failed permission check on /etc/passwd\0A\00"
@.str.3 = [29 x i8] c"/tmp/test-container-executor\00"
@.str.4 = [37 x i8] c"FAIL: failed permission check on %s\0A\00"
define void @test_check_configuration_permissions() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%2 = call i64 @check_configuration_permissions(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = call i64 @check_configuration_permissions(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"/etc/passwd\00"
@.str.3 = [29 x i8] c"/tmp/test-container-executor\00"
@.str.4 = [37 x i8] c"FAIL: failed permission check on %s\0A\00"
@str = [41 x i8] c"\0ATesting check_configuration_permissions\00"
@str.5 = [45 x i8] c"FAIL: failed permission check on /etc/passwd\00"
define void @test_check_configuration_permissions() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 @check_configuration_permissions(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = tail call i64 @check_configuration_permissions(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %7
ret void
}