#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*/ printf(char *);
scalar_t__ system(char *);
int remove_modules() {
  int err = 0;
  printf("uim:"
         " Removing btwilink "
         "\n");
  if (system("rmmod btwilink") != 0) {
    printf("uim:"
           " Error removing btwilink module"
           "\n");
    err = -1;
  } else {
    printf("uim:"
           " Removed btwilink module"
           "\n");
  }
  printf("uim:"
         " Removing fm_drv "
         "\n");
  if (system("rmmod fm_drv") != 0) {
    printf("uim:"
           " Error removing fm_drv module"
           "\n");
    err = -1;
  } else {
    printf("uim:"
           " Removed fm_drv module "
           "\n");
  }
  printf("uim:"
         " Removing st_drv "
         "\n");
  if (system("rmmod st_drv") != 0) {
    printf("uim:"
           " Error removing st_drv module"
           "\n");
    err = -1;
  } else {
    printf("uim:"
           " Removed st_drv module "
           "\n");
  }
  return err;
}


x86 assembly (clang, -O0):
<remove_modules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     1169 <remove_modules+0x49>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <remove_modules+0x55>
lea    0xedd(%rip),%rdi
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
call   1040 <printf@plt>
lea    0xefa(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     11af <remove_modules+0x8f>
lea    0xef1(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bb <remove_modules+0x9b>
lea    0xefc(%rip),%rdi
call   1040 <printf@plt>
lea    0xf0d(%rip),%rdi
call   1040 <printf@plt>
lea    0xf18(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     11f5 <remove_modules+0xd5>
lea    0xf0f(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1201 <remove_modules+0xe1>
lea    0xf1a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_modules>:
push   %rbp
push   %r14
push   %rbx
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
call   1040 <system@plt>
mov    %rax,%r14
test   %rax,%rax
lea    0xef8(%rip),%rax
lea    0xfb6(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xea3(%rip),%rdi
call   1040 <system@plt>
mov    %rax,%rbx
test   %rax,%rax
lea    0xef6(%rip),%rax
lea    0xf5f(%rip),%rdi
cmove  %rax,%rdi
or     %r14,%rbx
call   1030 <puts@plt>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe78(%rip),%rdi
call   1040 <system@plt>
test   %rax,%rax
lea    0xef3(%rip),%rcx
lea    0xf08(%rip),%rdi
cmove  %rcx,%rdi
xor    %ebp,%ebp
or     %rax,%rbx
setne  %bpl
neg    %ebp
call   1030 <puts@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"uim: Removing btwilink \0A\00"
@.str.1 = [15 x i8] c"rmmod btwilink\00"
@.str.2 = [37 x i8] c"uim: Error removing btwilink module\0A\00"
@.str.3 = [30 x i8] c"uim: Removed btwilink module\0A\00"
@.str.4 = [23 x i8] c"uim: Removing fm_drv \0A\00"
@.str.5 = [13 x i8] c"rmmod fm_drv\00"
@.str.6 = [35 x i8] c"uim: Error removing fm_drv module\0A\00"
@.str.7 = [29 x i8] c"uim: Removed fm_drv module \0A\00"
@.str.8 = [23 x i8] c"uim: Removing st_drv \0A\00"
@.str.9 = [13 x i8] c"rmmod st_drv\00"
@.str.10 = [35 x i8] c"uim: Error removing st_drv module\0A\00"
@.str.11 = [29 x i8] c"uim: Removed st_drv module \0A\00"
define i32 @remove_modules() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i64 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%11 = call i64 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %1
br label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%19 = call i64 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %1
br label %25
23: ; preds = %17
%24 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"rmmod btwilink\00"
@.str.5 = [13 x i8] c"rmmod fm_drv\00"
@.str.9 = [13 x i8] c"rmmod st_drv\00"
@str = [24 x i8] c"uim: Removing btwilink \00"
@str.12 = [29 x i8] c"uim: Removed btwilink module\00"
@str.13 = [22 x i8] c"uim: Removing fm_drv \00"
@str.14 = [28 x i8] c"uim: Removed fm_drv module \00"
@str.15 = [22 x i8] c"uim: Removing st_drv \00"
@str.16 = [28 x i8] c"uim: Removed st_drv module \00"
@str.17 = [34 x i8] c"uim: Error removing st_drv module\00"
@str.18 = [34 x i8] c"uim: Error removing fm_drv module\00"
@str.19 = [36 x i8] c"uim: Error removing btwilink module\00"
define i32 @remove_modules() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @str.19, i64 0, i64 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i64 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0)
%10 = or i64 %7, %2
%11 = icmp ne i64 %10, 0
%12 = tail call i32 @puts(i8* dereferenceable(1) %9)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0))
%14 = tail call i64 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.16, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @str.17, i64 0, i64 0)
%17 = xor i1 %15, true
%18 = or i1 %11, %17
%19 = sext i1 %18 to i32
%20 = tail call i32 @puts(i8* dereferenceable(1) %16)
ret i32 %19
}