#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 O_NONBLOCK;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int /*<<< orphan*/ __delete_module(char *, int);
int /*<<< orphan*/ __init_module(void *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int main() {
  int fd_null;
  fd_null = open("/dev/null", O_RDONLY);
  __init_module(NULL, 0, "foo=bar");
  __delete_module("__fAkE__sTaP__mOdUlE__", O_NONBLOCK);
  __init_module((void *)-1, 0, "foo=bar");
  __init_module(NULL, 0, (char *)-1);
  __delete_module((char *)-1, O_TRUNC);
  __delete_module("__fAkE__sTaP__mOdUlE__", -1);
  close(fd_null);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
lea    0xe96(%rip),%rdx
call   1040 <__init_module@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
lea    0xe89(%rip),%rdi
call   1030 <__delete_module@plt>
mov    $0xffffffffffffffff,%rdi
xor    %esi,%esi
lea    0xe6c(%rip),%rdx
call   1040 <__init_module@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
mov    $0xffffffffffffffff,%rdx
call   1040 <__init_module@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffffffffffff,%rdi
call   1030 <__delete_module@plt>
lea    0xe41(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <__delete_module@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
lea    0xeac(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%r14d
lea    0xea7(%rip),%rbx
xor    %edi,%edi
xor    %esi,%esi
mov    %rbx,%rdx
call   1040 <__init_module@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rbp
mov    %rbp,%rdi
call   1030 <__delete_module@plt>
mov    $0xffffffffffffffff,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1040 <__init_module@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0xffffffffffffffff,%rdx
call   1040 <__init_module@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffffffffffff,%rdi
call   1030 <__delete_module@plt>
mov    %rbp,%rdi
mov    $0xffffffff,%esi
call   1030 <__delete_module@plt>
mov    %r14d,%edi
call   1050 <close@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/null\00"
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"foo=bar\00"
@.str.2 = [23 x i8] c"__fAkE__sTaP__mOdUlE__\00"
@O_NONBLOCK = global i32 0
@O_TRUNC = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = call i32 @__init_module(i8* null, i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @O_NONBLOCK
%7 = call i32 @__delete_module(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @__init_module(i8* inttoptr (i64 -1 to i8*), i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @__init_module(i8* null, i32 0, i8* inttoptr (i64 -1 to i8*))
%10 = load i32, i32* @O_TRUNC
%11 = call i32 @__delete_module(i8* inttoptr (i64 -1 to i8*), i32 %10)
%12 = call i32 @__delete_module(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%13 = load i32, i32* %2
%14 = call i32 @close(i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/null\00"
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"foo=bar\00"
@.str.2 = [23 x i8] c"__fAkE__sTaP__mOdUlE__\00"
@O_NONBLOCK = global i32 0
@O_TRUNC = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @__init_module(i8* null, i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @O_NONBLOCK
%5 = tail call i32 @__delete_module(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @__init_module(i8* inttoptr (i64 -1 to i8*), i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @__init_module(i8* null, i32 0, i8* inttoptr (i64 -1 to i8*))
%8 = load i32, i32* @O_TRUNC
%9 = tail call i32 @__delete_module(i8* inttoptr (i64 -1 to i8*), i32 %8)
%10 = tail call i32 @__delete_module(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%11 = tail call i32 @close(i32 %2)
ret i32 0
}