#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 */
struct utsname {
  char *release;
};
struct stat {
  unsigned long st_size;
};
typedef int /*<<< orphan*/ module_path;

/* Variables and functions */
int EIO;
int ENOMEM;
char *MAP_FAILED;
int /*<<< orphan*/ MAP_PRIVATE;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ __NR_init_module;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ diagLog(int, char *, ...);
int /*<<< orphan*/ fstat(int, struct stat *);
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
char *mmap(void *, unsigned long, int /*<<< orphan*/, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
char *module_get_path(char *);
int /*<<< orphan*/ munmap(char *, unsigned long);
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *);
char *strchr(char *, char);
int strlen(char *);
int syscall(int /*<<< orphan*/, char *, unsigned long, char *);
int /*<<< orphan*/ uname(struct utsname *);
int module_install(char *filename) {
  int fd;
  struct stat st;
  unsigned long len;
  char *map;
  int ret;
  char *options;
  char *subpath;
  char module_path[256];
  struct utsname uts;
  options = strchr(filename, ' ');
  if (options) {
    options = options + 1;
    filename[options - filename - 1] = 0;
    printf("filename : %d,%s\n", strlen(filename), filename);
    printf("options  : %d,%s\n", strlen(options), options);
  }
  printf("Install Module:%s\n", filename);
  if (filename[0] != '/') {
    subpath = module_get_path(filename);
    if (!subpath) {
      diagLog(3, "Can not get module subpath\n");
      return -EIO;
    }
    uname(&uts);
    memset(&module_path, 0, sizeof(module_path));
    snprintf(module_path, sizeof(module_path), "%s/%s/%s", "/lib/modules",
             uts.release, subpath);
    fd = open(module_path, O_RDONLY, 0);
  } else {
    fd = open(filename, O_RDONLY, 0);
  }
  if (fd < 0) {
    diagLog(3, "cannot open module\n");
    return -EIO;
  }
  fstat(fd, &st);
  len = st.st_size;
  map = mmap(((void *)0), len, PROT_READ, MAP_PRIVATE, fd, 0);
  if (map == MAP_FAILED) {
    diagLog(3, "cannot mmap\n");
    close(fd);
    return -ENOMEM;
  }
  if (options)
    ret = syscall(__NR_init_module, map, len, options);
  else
    ret = syscall(__NR_init_module, map, len, "");
  if (ret != 0) {
    diagLog(3, "cannot insert `%s': (%li)\n", filename, ret);
  }
  munmap(map, len);
  close(fd);
  return ret;
}


x86 assembly (clang, -O0):
<module_install>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1060 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1269 <module_install+0x89>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
mov    -0x40(%rbp),%rdx
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1331 <module_install+0x151>
mov    -0x10(%rbp),%rdi
call   10f0 <module_get_path@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    12c9 <module_install+0xe9>
mov    $0x3,%edi
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1030 <diagLog@plt>
xor    %eax,%eax
mov    0x2d11(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1484 <module_install+0x2a4>
lea    -0x158(%rbp),%rdi
call   1090 <uname@plt>
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
lea    -0x150(%rbp),%rdi
mov    -0x158(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    $0x100,%esi
lea    0xd4d(%rip),%rdx
lea    0xd4f(%rip),%rcx
call   1080 <snprintf@plt>
lea    -0x150(%rbp),%rdi
mov    0x2cc0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <open@plt>
mov    %eax,-0x14(%rbp)
jmp    1348 <module_install+0x168>
mov    -0x10(%rbp),%rdi
mov    0x2ca4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1378 <module_install+0x198>
mov    $0x3,%edi
lea    0xd0b(%rip),%rsi
mov    $0x0,%al
call   1030 <diagLog@plt>
xor    %eax,%eax
mov    0x2c62(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1484 <module_install+0x2a4>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1100 <fstat@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    0x2c61(%rip),%rax
mov    (%rax),%edx
mov    0x2c20(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    0x2bf7(%rip),%rcx
cmp    (%rcx),%rax
jne    13f8 <module_install+0x218>
mov    $0x3,%edi
lea    0xca7(%rip),%rsi
mov    $0x0,%al
call   1030 <diagLog@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
xor    %eax,%eax
mov    0x2bda(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1484 <module_install+0x2a4>
cmpq   $0x0,-0x40(%rbp)
je     1425 <module_install+0x245>
mov    0x2ba6(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   10c0 <syscall@plt>
mov    %eax,-0x34(%rbp)
jmp    1445 <module_install+0x265>
mov    0x2b84(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xc67(%rip),%rcx
call   10c0 <syscall@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1469 <module_install+0x289>
mov    -0x10(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    $0x3,%edi
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   1030 <diagLog@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10d0 <munmap@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_install>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rdi,%rbx
mov    $0x20,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1253 <module_install+0x73>
mov    %rax,%r14
mov    %rbx,%rax
not    %rax
add    %r14,%rax
add    $0x1,%rax
add    $0x1,%r14
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xdd6(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xdcd(%rip),%rdi
mov    %eax,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1256 <module_install+0x76>
xor    %r14d,%r14d
lea    0xdc7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
cmpb   $0x2f,(%rbx)
jne    127a <module_install+0x9a>
mov    0x2d6d(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
jmp    12d8 <module_install+0xf8>
mov    %rbx,%rdi
call   10f0 <module_get_path@plt>
test   %rax,%rax
je     134d <module_install+0x16d>
mov    %rax,%rbp
mov    %rsp,%rdi
call   1090 <uname@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
mov    (%rsp),%r8
lea    0xd9e(%rip),%rdx
lea    0xda0(%rip),%rcx
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbp,%r9
call   1080 <snprintf@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %edx,%edx
call   10e0 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
js     1344 <module_install+0x164>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
call   1100 <fstat@plt>
mov    0x8(%rsp),%r12
mov    0x2cf9(%rip),%rax
mov    (%rax),%edx
mov    0x2cb8(%rip),%rax
mov    (%rax),%ecx
xor    %ebp,%ebp
xor    %edi,%edi
mov    %r12,%rsi
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,%r13
mov    0x2c92(%rip),%rax
cmp    (%rax),%r13
je     136d <module_install+0x18d>
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
test   %r14,%r14
je     1393 <module_install+0x1b3>
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
jmp    13a0 <module_install+0x1c0>
lea    0xd1e(%rip),%rsi
jmp    1354 <module_install+0x174>
lea    0xce3(%rip),%rsi
xor    %ebp,%ebp
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <diagLog@plt>
mov    0x2c67(%rip),%rax
sub    (%rax),%ebp
jmp    13d6 <module_install+0x1f6>
lea    0xd09(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <diagLog@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    0x2c39(%rip),%rax
sub    (%rax),%ebp
jmp    13d6 <module_install+0x1f6>
lea    0xd0a(%rip),%rcx
mov    %r13,%rsi
mov    %r12,%rdx
call   10c0 <syscall@plt>
mov    %eax,%ebp
test   %eax,%eax
je     13c3 <module_install+0x1e3>
lea    0xcd8(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <diagLog@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   10d0 <munmap@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %ebp,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
%struct.utsname = type { i8* }
@.str = [18 x i8] c"filename : %d,%s\0A\00"
@.str.1 = [18 x i8] c"options : %d,%s\0A\00"
@.str.2 = [19 x i8] c"Install Module:%s\0A\00"
@.str.3 = [28 x i8] c"Can not get module subpath\0A\00"
@EIO = global i32 0
@.str.4 = [9 x i8] c"%s/%s/%s\00"
@.str.5 = [13 x i8] c"/lib/modules\00"
@O_RDONLY = global i32 0
@.str.6 = [20 x i8] c"cannot open module\0A\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.7 = [13 x i8] c"cannot mmap\0A\00"
@ENOMEM = global i32 0
@__NR_init_module = global i32 0
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [27 x i8] c"cannot insert `%s': (%li)\0A\00"
define i32 @module_install(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.stat
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
%12 = alloca %struct.utsname
store i8* %0, i8** %3
%13 = load i8*, i8** %3
%14 = call i8* @strchr(i8* %13, i8 signext 32)
store i8* %14, i8** %9
%15 = load i8*, i8** %9
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %36
17: ; preds = %1
%18 = load i8*, i8** %9
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8* %19, i8** %9
%20 = load i8*, i8** %3
%21 = load i8*, i8** %9
%22 = load i8*, i8** %3
%23 = ptrtoint i8* %21 to i64
%24 = ptrtoint i8* %22 to i64
%25 = sub i64 %23, %24
%26 = sub nsw i64 %25, 1
%27 = getelementptr inbounds i8, i8* %20, i64 %26
store i8 0, i8* %27
%28 = load i8*, i8** %3
%29 = call i32 @strlen(i8* %28)
%30 = load i8*, i8** %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %29, i8* %30)
%32 = load i8*, i8** %9
%33 = call i32 @strlen(i8* %32)
%34 = load i8*, i8** %9
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %33, i8* %34)
br label %36
36: ; preds = %17, %1
%37 = load i8*, i8** %3
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 0
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 47
br i1 %43, label %44, label %65
44: ; preds = %36
%45 = load i8*, i8** %3
%46 = call i8* @module_get_path(i8* %45)
store i8* %46, i8** %10
%47 = load i8*, i8** %10
%48 = icmp ne i8* %47, null
br i1 %48, label %53, label %49
49: ; preds = %44
%50 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%51 = load i32, i32* @EIO
%52 = sub nsw i32 0, %51
store i32 %52, i32* %2
br label %123
53: ; preds = %44
%54 = call i32 @uname(%struct.utsname* %12)
%55 = bitcast [256 x i8]* %11 to i8**
%56 = call i32 @memset(i8** %55, i32 0, i32 256)
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%58 = getelementptr inbounds %struct.utsname, %struct.utsname* %12, i32 0, i32 0
%59 = load i8*, i8** %58
%60 = load i8*, i8** %10
%61 = call i32 @snprintf(i8* %57, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %59, i8* %60)
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%63 = load i32, i32* @O_RDONLY
%64 = call i32 @open(i8* %62, i32 %63, i32 0)
store i32 %64, i32* %4
br label %69
65: ; preds = %36
%66 = load i8*, i8** %3
%67 = load i32, i32* @O_RDONLY
%68 = call i32 @open(i8* %66, i32 %67, i32 0)
store i32 %68, i32* %4
br label %69
69: ; preds = %65, %53
%70 = load i32, i32* %4
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%74 = load i32, i32* @EIO
%75 = sub nsw i32 0, %74
store i32 %75, i32* %2
br label %123
76: ; preds = %69
%77 = load i32, i32* %4
%78 = call i32 @fstat(i32 %77, %struct.stat* %5)
%79 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%80 = load i64, i64* %79
store i64 %80, i64* %6
%81 = load i64, i64* %6
%82 = load i32, i32* @PROT_READ
%83 = load i32, i32* @MAP_PRIVATE
%84 = load i32, i32* %4
%85 = call i8* @mmap(i8* null, i64 %81, i32 %82, i32 %83, i32 %84, i32 0)
store i8* %85, i8** %7
%86 = load i8*, i8** %7
%87 = load i8*, i8** @MAP_FAILED
%88 = icmp eq i8* %86, %87
br i1 %88, label %89, label %95
89: ; preds = %76
%90 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%91 = load i32, i32* %4
%92 = call i32 @close(i32 %91)
%93 = load i32, i32* @ENOMEM
%94 = sub nsw i32 0, %93
store i32 %94, i32* %2
br label %123
95: ; preds = %76
%96 = load i8*, i8** %9
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %104
98: ; preds = %95
%99 = load i32, i32* @__NR_init_module
%100 = load i8*, i8** %7
%101 = load i64, i64* %6
%102 = load i8*, i8** %9
%103 = call i32 @syscall(i32 %99, i8* %100, i64 %101, i8* %102)
store i32 %103, i32* %8
br label %109
104: ; preds = %95
%105 = load i32, i32* @__NR_init_module
%106 = load i8*, i8** %7
%107 = load i64, i64* %6
%108 = call i32 @syscall(i32 %105, i8* %106, i64 %107, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0))
store i32 %108, i32* %8
br label %109
109: ; preds = %104, %98
%110 = load i32, i32* %8
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %116
112: ; preds = %109
%113 = load i8*, i8** %3
%114 = load i32, i32* %8
%115 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %113, i32 %114)
br label %116
116: ; preds = %112, %109
%117 = load i8*, i8** %7
%118 = load i64, i64* %6
%119 = call i32 @munmap(i8* %117, i64 %118)
%120 = load i32, i32* %4
%121 = call i32 @close(i32 %120)
%122 = load i32, i32* %8
store i32 %122, i32* %2
br label %123
123: ; preds = %116, %89, %72, %49
%124 = load i32, i32* %2
ret i32 %124
}

LLVM IR (-O2):
%struct.stat = type { i64 }
%struct.utsname = type { i8* }
@.str = [18 x i8] c"filename : %d,%s\0A\00"
@.str.1 = [18 x i8] c"options : %d,%s\0A\00"
@.str.2 = [19 x i8] c"Install Module:%s\0A\00"
@.str.3 = [28 x i8] c"Can not get module subpath\0A\00"
@EIO = global i32 0
@.str.4 = [9 x i8] c"%s/%s/%s\00"
@.str.5 = [13 x i8] c"/lib/modules\00"
@O_RDONLY = global i32 0
@.str.6 = [20 x i8] c"cannot open module\0A\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.7 = [13 x i8] c"cannot mmap\0A\00"
@ENOMEM = global i32 0
@__NR_init_module = global i32 0
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [27 x i8] c"cannot insert `%s': (%li)\0A\00"
define i32 @module_install(i8* %0) {
%2 = alloca %struct.stat
%3 = alloca [256 x i8]
%4 = alloca %struct.utsname
%5 = bitcast %struct.stat* %2 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.utsname* %4 to i8*
%8 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 32)
%9 = icmp eq i8* %8, null
br i1 %9, label %21, label %10
10: ; preds = %1
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = ptrtoint i8* %11 to i64
%13 = ptrtoint i8* %0 to i64
%14 = xor i64 %13, -1
%15 = add i64 %12, %14
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 0, i8* %16
%17 = tail call i32 @strlen(i8* %0)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %17, i8* %0)
%19 = tail call i32 @strlen(i8* %11)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %11)
br label %21
21: ; preds = %10, %1
%22 = phi i8* [ %11, %10 ], [ null, %1 ]
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%24 = load i8, i8* %0
%25 = icmp eq i8 %24, 47
br i1 %25, label %42, label %26
26: ; preds = %21
%27 = tail call i8* @module_get_path(i8* %0)
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = tail call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* @EIO
%32 = sub nsw i32 0, %31
br label %81
33: ; preds = %26
%34 = call i32 @uname(%struct.utsname* %4)
%35 = bitcast [256 x i8]* %3 to i8**
%36 = call i32 @memset(i8** %35, i32 0, i32 256)
%37 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 0
%38 = load i8*, i8** %37
%39 = call i32 @snprintf(i8* %6, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %38, i8* %27)
%40 = load i32, i32* @O_RDONLY
%41 = call i32 @open(i8* %6, i32 %40, i32 0)
br label %45
42: ; preds = %21
%43 = load i32, i32* @O_RDONLY
%44 = tail call i32 @open(i8* %0, i32 %43, i32 0)
br label %45
45: ; preds = %42, %33
%46 = phi i32 [ %41, %33 ], [ %44, %42 ]
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%50 = load i32, i32* @EIO
%51 = sub nsw i32 0, %50
br label %81
52: ; preds = %45
%53 = call i32 @fstat(i32 %46, %struct.stat* %2)
%54 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%55 = load i64, i64* %54
%56 = load i32, i32* @PROT_READ
%57 = load i32, i32* @MAP_PRIVATE
%58 = call i8* @mmap(i8* null, i64 %55, i32 %56, i32 %57, i32 %46, i32 0)
%59 = load i8*, i8** @MAP_FAILED
%60 = icmp eq i8* %58, %59
br i1 %60, label %61, label %66
61: ; preds = %52
%62 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%63 = call i32 @close(i32 %46)
%64 = load i32, i32* @ENOMEM
%65 = sub nsw i32 0, %64
br label %81
66: ; preds = %52
%67 = icmp eq i8* %22, null
%68 = load i32, i32* @__NR_init_module
br i1 %67, label %71, label %69
69: ; preds = %66
%70 = call i32 @syscall(i32 %68, i8* %58, i64 %55, i8* %22)
br label %73
71: ; preds = %66
%72 = call i32 @syscall(i32 %68, i8* %58, i64 %55, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0))
br label %73
73: ; preds = %71, %69
%74 = phi i32 [ %70, %69 ], [ %72, %71 ]
%75 = icmp eq i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %73
%77 = call i32 (i32, i8*, ...) @diagLog(i32 3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %0, i32 %74)
br label %78
78: ; preds = %76, %73
%79 = call i32 @munmap(i8* %58, i64 %55)
%80 = call i32 @close(i32 %46)
br label %81
81: ; preds = %78, %61, %48, %29
%82 = phi i32 [ %51, %48 ], [ %65, %61 ], [ %74, %78 ], [ %32, %29 ]
ret i32 %82
}