#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 /*<<< orphan*/ SIGILL;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int setenv(char *, char *, int);
int /*<<< orphan*/ stderr;
int samba_init_module(void) {
  int rc;
  fprintf(stderr, "Test dummy executed!\n");
  rc = setenv("UNITTEST_DUMMY_MODULE_LOADED", "TRUE", 1);
  if (rc < 0) {
    kill(getpid(), SIGILL);
    exit(-1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<samba_init_module>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xea2(%rip),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    11b3 <samba_init_module+0x63>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%edi
mov    0x2e46(%rip),%rax
mov    (%rax),%esi
call   1060 <kill@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<samba_init_module>:
push   %rax
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xea9(%rip),%rdi
lea    0xebf(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
test   %eax,%eax
js     1186 <samba_init_module+0x36>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1040 <getpid@plt>
mov    0x2e54(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1060 <kill@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Test dummy executed!\0A\00"
@.str.1 = [29 x i8] c"UNITTEST_DUMMY_MODULE_LOADED\00"
@.str.2 = [5 x i8] c"TRUE\00"
@SIGILL = global i32 0
define i32 @samba_init_module() {
%1 = alloca i32
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @setenv(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = call i32 (...) @getpid()
%9 = load i32, i32* @SIGILL
%10 = call i32 @kill(i32 %8, i32 %9)
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Test dummy executed!\0A\00"
@.str.1 = [29 x i8] c"UNITTEST_DUMMY_MODULE_LOADED\00"
@.str.2 = [5 x i8] c"TRUE\00"
@SIGILL = global i32 0
define i32 @samba_init_module() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @setenv(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = tail call i32 (...) @getpid()
%7 = load i32, i32* @SIGILL
%8 = tail call i32 @kill(i32 %6, i32 %7)
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %0
ret i32 0
}