#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 */
typedef int /*<<< orphan*/ ctl;

/* Variables and functions */
int CTL_KERN;
int KERN_MODPROBE;
int /*<<< orphan*/ perror(char *);
scalar_t__ sysctl(int *, int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  char *, int);
int main(int argc, char *argv[]) {
  int ctl[2];
  ctl[0] = CTL_KERN;
  ctl[1] = KERN_MODPROBE;
  if (sysctl(ctl, sizeof(ctl), NULL, NULL, "/tmp/buster", 14)) {
    perror("sysctl");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x8,%esi
xor    %eax,%eax
mov    %eax,%ecx
lea    0xe9e(%rip),%r8
mov    $0xe,%r9d
mov    %rcx,%rdx
call   1030 <sysctl@plt>
cmp    $0x0,%rax
je     1192 <main+0x72>
lea    0xe8b(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1199 <main+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0xeba(%rip),%r8
xor    %ebx,%ebx
lea    0x8(%rsp),%rdi
mov    $0x8,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xe,%r9d
call   1030 <sysctl@plt>
test   %rax,%rax
jne    116e <main+0x4e>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe97(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%ebx
jmp    1166 <main+0x46>

LLVM IR (-O0):
@CTL_KERN = global i32 0
@KERN_MODPROBE = global i32 0
@.str = [12 x i8] c"/tmp/buster\00"
@.str.1 = [7 x i8] c"sysctl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @CTL_KERN
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %7, i32* %8
%9 = load i32, i32* @KERN_MODPROBE
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %9, i32* %10
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%12 = call i64 @sysctl(i32* %11, i32 8, i32* null, i32* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 14)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %17
16: ; preds = %2
store i32 0, i32* %3
br label %17
17: ; preds = %16, %14
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@CTL_KERN = global i32 0
@KERN_MODPROBE = global i32 0
@.str = [12 x i8] c"/tmp/buster\00"
@.str.1 = [7 x i8] c"sysctl\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = load i32, i32* @CTL_KERN
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %5, i32* %6
%7 = load i32, i32* @KERN_MODPROBE
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %7, i32* %8
%9 = call i64 @sysctl(i32* %6, i32 8, i32* null, i32* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 14)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %2, %11
%14 = phi i32 [ 1, %11 ], [ 0, %2 ]
ret i32 %14
}