#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 AT_FDCWD;
int S_IFBLK;
int S_IFCHR;
int S_IFIFO;
int S_IFREG;
int S_IFSOCK;
int /*<<< orphan*/ __NR_mknod;
int /*<<< orphan*/ __mknodat(int, char const *, int, int);
int /*<<< orphan*/ mknod(char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ syscall(int /*<<< orphan*/, char *, int, int);
int main() {
  mknod("testfile1", S_IFREG | 0644, 0);
  __mknodat(AT_FDCWD, "testfile2", S_IFREG | 0644, 0);
  mknod((const char *)-1, S_IFREG | 0644, 0);
  mknod("testfile1", -1, 0);
  syscall(__NR_mknod, "testfile1", 1, -1);
  __mknodat(-1, "testfile2", S_IFREG | 0644, 0);
  __mknodat(-1, "testfile2", S_IFCHR | 0644, 0);
  __mknodat(-1, "testfile2", S_IFBLK | 0644, 0);
  __mknodat(-1, "testfile2", S_IFIFO | 0644, 0);
  __mknodat(-1, "testfile2", S_IFSOCK | 0644, 0);
  __mknodat(AT_FDCWD, (const char *)-1, S_IFREG | 0644, 0);
  __mknodat(AT_FDCWD, "testfile2", -1, 0);
  __mknodat(AT_FDCWD, "testfile2", 1, -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
or     $0x1a4,%esi
lea    0xeab(%rip),%rdi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
lea    0xe8f(%rip),%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%esi
or     $0x1a4,%esi
mov    $0xffffffffffffffff,%rdi
xor    %edx,%edx
call   1040 <mknod@plt>
lea    0xe5a(%rip),%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1030 <syscall@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0xffffffff,%edi
lea    0xe1e(%rip),%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0xffffffff,%edi
lea    0xdfc(%rip),%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0xffffffff,%edi
lea    0xdda(%rip),%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0xffffffff,%edi
lea    0xdb8(%rip),%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0xffffffff,%edi
lea    0xd96(%rip),%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
mov    0x2d5d(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0xffffffffffffffff,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
lea    0xd59(%rip),%rsi
mov    $0xffffffff,%edx
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
lea    0xd3d(%rip),%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1050 <__mknodat@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2ea8(%rip),%r13
mov    $0x1a4,%ebx
mov    0x0(%r13),%esi
or     %ebx,%esi
lea    0xeae(%rip),%r15
mov    %r15,%rdi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    0x2e45(%rip),%r12
mov    (%r12),%edi
mov    0x0(%r13),%edx
or     %ebx,%edx
lea    0xe96(%rip),%r14
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x0(%r13),%esi
or     %ebx,%esi
mov    $0xffffffffffffffff,%rdi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    %r15,%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    %r15,%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1030 <syscall@plt>
mov    0x0(%r13),%edx
or     %ebx,%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edx
or     %ebx,%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2dde(%rip),%rax
mov    (%rax),%edx
or     %ebx,%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%edx
or     %ebx,%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edx
or     %ebx,%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    (%r12),%edi
or     0x0(%r13),%ebx
mov    $0xffffffffffffffff,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    (%r12),%edi
mov    %r14,%rsi
mov    $0xffffffff,%edx
xor    %ecx,%ecx
call   1050 <__mknodat@plt>
mov    (%r12),%edi
mov    %r14,%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1050 <__mknodat@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"testfile1\00"
@S_IFREG = global i32 0
@AT_FDCWD = global i32 0
@.str.1 = [10 x i8] c"testfile2\00"
@__NR_mknod = global i32 0
@S_IFCHR = global i32 0
@S_IFBLK = global i32 0
@S_IFIFO = global i32 0
@S_IFSOCK = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @S_IFREG
%3 = or i32 %2, 420
%4 = call i32 @mknod(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3, i32 0)
%5 = load i32, i32* @AT_FDCWD
%6 = load i32, i32* @S_IFREG
%7 = or i32 %6, 420
%8 = call i32 @__mknodat(i32 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 0)
%9 = load i32, i32* @S_IFREG
%10 = or i32 %9, 420
%11 = call i32 @mknod(i8* inttoptr (i64 -1 to i8*), i32 %10, i32 0)
%12 = call i32 @mknod(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 -1, i32 0)
%13 = load i32, i32* @__NR_mknod
%14 = call i32 @syscall(i32 %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 -1)
%15 = load i32, i32* @S_IFREG
%16 = or i32 %15, 420
%17 = call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 0)
%18 = load i32, i32* @S_IFCHR
%19 = or i32 %18, 420
%20 = call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 0)
%21 = load i32, i32* @S_IFBLK
%22 = or i32 %21, 420
%23 = call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 0)
%24 = load i32, i32* @S_IFIFO
%25 = or i32 %24, 420
%26 = call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 0)
%27 = load i32, i32* @S_IFSOCK
%28 = or i32 %27, 420
%29 = call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 0)
%30 = load i32, i32* @AT_FDCWD
%31 = load i32, i32* @S_IFREG
%32 = or i32 %31, 420
%33 = call i32 @__mknodat(i32 %30, i8* inttoptr (i64 -1 to i8*), i32 %32, i32 0)
%34 = load i32, i32* @AT_FDCWD
%35 = call i32 @__mknodat(i32 %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 0)
%36 = load i32, i32* @AT_FDCWD
%37 = call i32 @__mknodat(i32 %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 -1)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"testfile1\00"
@S_IFREG = global i32 0
@AT_FDCWD = global i32 0
@.str.1 = [10 x i8] c"testfile2\00"
@__NR_mknod = global i32 0
@S_IFCHR = global i32 0
@S_IFBLK = global i32 0
@S_IFIFO = global i32 0
@S_IFSOCK = global i32 0
define i32 @main() {
%1 = load i32, i32* @S_IFREG
%2 = or i32 %1, 420
%3 = tail call i32 @mknod(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 0)
%4 = load i32, i32* @AT_FDCWD
%5 = load i32, i32* @S_IFREG
%6 = or i32 %5, 420
%7 = tail call i32 @__mknodat(i32 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 0)
%8 = load i32, i32* @S_IFREG
%9 = or i32 %8, 420
%10 = tail call i32 @mknod(i8* inttoptr (i64 -1 to i8*), i32 %9, i32 0)
%11 = tail call i32 @mknod(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 -1, i32 0)
%12 = load i32, i32* @__NR_mknod
%13 = tail call i32 @syscall(i32 %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 -1)
%14 = load i32, i32* @S_IFREG
%15 = or i32 %14, 420
%16 = tail call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 0)
%17 = load i32, i32* @S_IFCHR
%18 = or i32 %17, 420
%19 = tail call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 0)
%20 = load i32, i32* @S_IFBLK
%21 = or i32 %20, 420
%22 = tail call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 0)
%23 = load i32, i32* @S_IFIFO
%24 = or i32 %23, 420
%25 = tail call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 0)
%26 = load i32, i32* @S_IFSOCK
%27 = or i32 %26, 420
%28 = tail call i32 @__mknodat(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 0)
%29 = load i32, i32* @AT_FDCWD
%30 = load i32, i32* @S_IFREG
%31 = or i32 %30, 420
%32 = tail call i32 @__mknodat(i32 %29, i8* inttoptr (i64 -1 to i8*), i32 %31, i32 0)
%33 = load i32, i32* @AT_FDCWD
%34 = tail call i32 @__mknodat(i32 %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 0)
%35 = load i32, i32* @AT_FDCWD
%36 = tail call i32 @__mknodat(i32 %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 -1)
ret i32 0
}