#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 unlink_fundamental_device(char const *, char *);
int unlink_fundamental_devices(const char *chroot_path) {
  int err = 0;
  err |= unlink_fundamental_device(chroot_path, "/dev/null");
  err |= unlink_fundamental_device(chroot_path, "/dev/zero");
  err |= unlink_fundamental_device(chroot_path, "/dev/random");
  err |= unlink_fundamental_device(chroot_path, "/dev/urandom");
  return err ? 125 : 0;
}


x86 assembly (clang, -O0):
<unlink_fundamental_devices>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <unlink_fundamental_device@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <unlink_fundamental_device@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <unlink_fundamental_device@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <unlink_fundamental_device@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x7d,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlink_fundamental_devices>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xedf(%rip),%rsi
call   1030 <unlink_fundamental_device@plt>
mov    %eax,%r14d
lea    0xeda(%rip),%rsi
mov    %r15,%rdi
call   1030 <unlink_fundamental_device@plt>
mov    %eax,%ebp
or     %r14d,%ebp
lea    0xed0(%rip),%rsi
mov    %r15,%rdi
call   1030 <unlink_fundamental_device@plt>
mov    %eax,%ebx
or     %ebp,%ebx
lea    0xec9(%rip),%rsi
mov    %r15,%rdi
call   1030 <unlink_fundamental_device@plt>
xor    %ecx,%ecx
or     %ebx,%eax
mov    $0x7d,%eax
cmove  %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/null\00"
@.str.1 = [10 x i8] c"/dev/zero\00"
@.str.2 = [12 x i8] c"/dev/random\00"
@.str.3 = [13 x i8] c"/dev/urandom\00"
define i32 @unlink_fundamental_devices(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @unlink_fundamental_device(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %3
%7 = or i32 %6, %5
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = call i32 @unlink_fundamental_device(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = or i32 %10, %9
store i32 %11, i32* %3
%12 = load i8*, i8** %2
%13 = call i32 @unlink_fundamental_device(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i8*, i8** %2
%17 = call i32 @unlink_fundamental_device(i8* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = or i32 %18, %17
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 125, i32 0
ret i32 %23
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/null\00"
@.str.1 = [10 x i8] c"/dev/zero\00"
@.str.2 = [12 x i8] c"/dev/random\00"
@.str.3 = [13 x i8] c"/dev/urandom\00"
define i32 @unlink_fundamental_devices(i8* %0) {
%2 = tail call i32 @unlink_fundamental_device(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @unlink_fundamental_device(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = or i32 %3, %2
%5 = tail call i32 @unlink_fundamental_device(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%6 = or i32 %4, %5
%7 = tail call i32 @unlink_fundamental_device(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%8 = or i32 %6, %7
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 125
ret i32 %10
}