#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 do_test(char *, int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
            int);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ test_title(char *);
int test1(void) {
  int err = 0;
  test_title("Test 1. Module insertion and removal");
  err |= do_test(("insmod "
                  "uart16550"
                  ", default options"),
                 (system("insmod "
                         "uart16550"
                         ".ko")),
                 (0), 0, 1);
  err |= do_test(("major"),
                 (system("cat /proc/devices | grep '"
                         "42"
                         " "
                         "uart16550"
                         "' >/dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("ioports COM1"),
                 (system("cat /proc/ioports | grep '03f8-03ff : "
                         "uart16550"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("ioports COM2"),
                 (system("cat /proc/ioports | grep '02f8-02ff : "
                         "uart16550"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("interrupts COM1"),
                 (system("cat /proc/interrupts | grep '4:.*"
                         "uart16550"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("interrupts COM2"),
                 (system("cat /proc/interrupts | grep '3:.*"
                         "uart16550"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("rmmod"),
                 (system("rmmod "
                         "uart16550")),
                 (0), 0, 0);
  if (err)
    return err;
  err |= do_test(("insmod "
                  "uart16550"
                  ", major="
                  "42"),
                 (system("insmod "
                         "uart16550"
                         ".ko major="
                         "42")),
                 (0), 0, 1);
  err |= do_test(("major"),
                 (system("cat /proc/devices | grep '"
                         "42"
                         " "
                         "uart16550"
                         "' >/dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("rmmod"),
                 (system("rmmod "
                         "uart16550")),
                 (0), 0, 0);
  if (err)
    return err;
  err |= do_test(("insmod "
                  "uart16550"
                  ", COM2 only"),
                 (system("insmod "
                         "uart16550"
                         ".ko option="
                         "2")),
                 (0), 0, 1);
  err |= do_test(("insmod "
                  "solution"
                  ", COM1 only"),
                 (system("insmod "
                         "solution"
                         ".ko option="
                         "1")),
                 (0), 0, 1);
  err |= do_test(("ioports COM1"),
                 (system("cat /proc/ioports | grep '03f8-03ff : "
                         "solution"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("ioports COM2"),
                 (system("cat /proc/ioports | grep '02f8-02ff : "
                         "uart16550"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("interrupts COM1"),
                 (system("cat /proc/interrupts | grep '4:.*"
                         "solution"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("interrupts COM2"),
                 (system("cat /proc/interrupts | grep '3:.*"
                         "uart16550"
                         "' > /dev/null 2>&1")),
                 (0), 0, 0);
  err |= do_test(("rmmod "
                  "uart16550"),
                 (system("rmmod "
                         "uart16550")),
                 (0), 0, 0);
  err |= do_test(("rmmod "
                  "solution"),
                 (system("rmmod "
                         "solution")),
                 (0), 0, 0);
  return err;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <test_title@plt>
lea    0xef5(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xec5(%rip),%rdi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xed1(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf01(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xee6(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf27(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xf0c(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf50(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xf32(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf74(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xf56(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf8e(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xf7a(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1280 <test1+0x150>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <test1+0x331>
lea    0xf7b(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xf52(%rip),%rdi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xdb0(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xd9c(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xefd(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xee9(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1311 <test1+0x1e1>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1461 <test1+0x331>
lea    0xf23(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xef9(%rip),%rdi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf31(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xf08(%rip),%rdi
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf23(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xd1f(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xd60(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xd45(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xf12(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xd6b(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xdad(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xd8f(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xdc7(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xdb9(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%esi
lea    0xec5(%rip),%rdi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1050 <do_test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1040 <test_title@plt>
lea    0xefd(%rip),%rdi
call   1030 <system@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebx
lea    0xef1(%rip),%rdi
call   1030 <system@plt>
lea    0xedf(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
lea    0xf11(%rip),%rdi
call   1030 <system@plt>
lea    0xef8(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%r14d
lea    0xf3c(%rip),%rdi
call   1030 <system@plt>
lea    0xf23(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebx
or     %r14d,%ebx
or     %ebp,%ebx
lea    0xf66(%rip),%rdi
call   1030 <system@plt>
lea    0xf4a(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%r14d
lea    0xf8f(%rip),%rdi
call   1030 <system@plt>
lea    0xf73(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebp
or     %r14d,%ebp
or     %ebx,%ebp
lea    0xfaa(%rip),%rdi
call   1030 <system@plt>
lea    0xf98(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
or     %ebp,%eax
jne    13f2 <test1+0x2c2>
lea    0xfac(%rip),%rdi
call   1030 <system@plt>
lea    0xf85(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebx
lea    0xde5(%rip),%rdi
call   1030 <system@plt>
lea    0xdd3(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
lea    0xf36(%rip),%rdi
call   1030 <system@plt>
lea    0xf24(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
or     %ebp,%eax
jne    13f2 <test1+0x2c2>
lea    0xf71(%rip),%rdi
call   1030 <system@plt>
lea    0xf49(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebx
lea    0xf83(%rip),%rdi
call   1030 <system@plt>
lea    0xf5c(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
lea    0xf77(%rip),%rdi
call   1030 <system@plt>
lea    0xd75(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%r14d
lea    0xdb9(%rip),%rdi
call   1030 <system@plt>
lea    0xda0(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%r15d
or     %r14d,%r15d
or     %ebp,%r15d
lea    0xf6a(%rip),%rdi
call   1030 <system@plt>
lea    0xdc5(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%r14d
lea    0xe0a(%rip),%rdi
call   1030 <system@plt>
lea    0xdee(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebp
or     %r14d,%ebp
lea    0xe27(%rip),%r14
mov    %r14,%rdi
call   1030 <system@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
mov    %eax,%ebx
or     %ebp,%ebx
or     %r15d,%ebx
lea    0xf35(%rip),%rbp
mov    %rbp,%rdi
call   1030 <system@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <do_test@plt>
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Test 1. Module insertion and removal\00"
@.str.1 = [34 x i8] c"insmod uart16550, default options\00"
@.str.2 = [20 x i8] c"insmod uart16550.ko\00"
@.str.3 = [6 x i8] c"major\00"
@.str.4 = [56 x i8] c"cat /proc/devices | grep '42 uart16550' >/dev/null 2>&1\00"
@.str.5 = [13 x i8] c"ioports COM1\00"
@.str.6 = [66 x i8] c"cat /proc/ioports | grep '03f8-03ff : uart16550' > /dev/null 2>&1\00"
@.str.7 = [13 x i8] c"ioports COM2\00"
@.str.8 = [66 x i8] c"cat /proc/ioports | grep '02f8-02ff : uart16550' > /dev/null 2>&1\00"
@.str.9 = [16 x i8] c"interrupts COM1\00"
@.str.10 = [61 x i8] c"cat /proc/interrupts | grep '4:.*uart16550' > /dev/null 2>&1\00"
@.str.11 = [16 x i8] c"interrupts COM2\00"
@.str.12 = [61 x i8] c"cat /proc/interrupts | grep '3:.*uart16550' > /dev/null 2>&1\00"
@.str.13 = [6 x i8] c"rmmod\00"
@.str.14 = [16 x i8] c"rmmod uart16550\00"
@.str.15 = [27 x i8] c"insmod uart16550, major=42\00"
@.str.16 = [29 x i8] c"insmod uart16550.ko major=42\00"
@.str.17 = [28 x i8] c"insmod uart16550, COM2 only\00"
@.str.18 = [29 x i8] c"insmod uart16550.ko option=2\00"
@.str.19 = [27 x i8] c"insmod solution, COM1 only\00"
@.str.20 = [28 x i8] c"insmod solution.ko option=1\00"
@.str.21 = [65 x i8] c"cat /proc/ioports | grep '03f8-03ff : solution' > /dev/null 2>&1\00"
@.str.22 = [60 x i8] c"cat /proc/interrupts | grep '4:.*solution' > /dev/null 2>&1\00"
@.str.23 = [15 x i8] c"rmmod solution\00"
define i32 @test1() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 @test_title(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @do_test(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 0, i32 0, i32 1)
%6 = load i32, i32* %2
%7 = or i32 %6, %5
store i32 %7, i32* %2
%8 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 0, i32 0, i32 0)
%10 = load i32, i32* %2
%11 = or i32 %10, %9
store i32 %11, i32* %2
%12 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %12, i32 0, i32 0, i32 0)
%14 = load i32, i32* %2
%15 = or i32 %14, %13
store i32 %15, i32* %2
%16 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %16, i32 0, i32 0, i32 0)
%18 = load i32, i32* %2
%19 = or i32 %18, %17
store i32 %19, i32* %2
%20 = call i32 @system(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %20, i32 0, i32 0, i32 0)
%22 = load i32, i32* %2
%23 = or i32 %22, %21
store i32 %23, i32* %2
%24 = call i32 @system(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
%25 = call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 %24, i32 0, i32 0, i32 0)
%26 = load i32, i32* %2
%27 = or i32 %26, %25
store i32 %27, i32* %2
%28 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
%29 = call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %28, i32 0, i32 0, i32 0)
%30 = load i32, i32* %2
%31 = or i32 %30, %29
store i32 %31, i32* %2
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %0
%35 = load i32, i32* %2
store i32 %35, i32* %1
br label %87
36: ; preds = %0
%37 = call i32 @system(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.16, i64 0, i64 0))
%38 = call i32 @do_test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i32 %37, i32 0, i32 0, i32 1)
%39 = load i32, i32* %2
%40 = or i32 %39, %38
store i32 %40, i32* %2
%41 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 0, i32 0, i32 0)
%43 = load i32, i32* %2
%44 = or i32 %43, %42
store i32 %44, i32* %2
%45 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
%46 = call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %45, i32 0, i32 0, i32 0)
%47 = load i32, i32* %2
%48 = or i32 %47, %46
store i32 %48, i32* %2
%49 = load i32, i32* %2
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %36
%52 = load i32, i32* %2
store i32 %52, i32* %1
br label %87
53: ; preds = %36
%54 = call i32 @system(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0))
%55 = call i32 @do_test(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0), i32 %54, i32 0, i32 0, i32 1)
%56 = load i32, i32* %2
%57 = or i32 %56, %55
store i32 %57, i32* %2
%58 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
%59 = call i32 @do_test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0), i32 %58, i32 0, i32 0, i32 1)
%60 = load i32, i32* %2
%61 = or i32 %60, %59
store i32 %61, i32* %2
%62 = call i32 @system(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.21, i64 0, i64 0))
%63 = call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %62, i32 0, i32 0, i32 0)
%64 = load i32, i32* %2
%65 = or i32 %64, %63
store i32 %65, i32* %2
%66 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%67 = call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %66, i32 0, i32 0, i32 0)
%68 = load i32, i32* %2
%69 = or i32 %68, %67
store i32 %69, i32* %2
%70 = call i32 @system(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.22, i64 0, i64 0))
%71 = call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %70, i32 0, i32 0, i32 0)
%72 = load i32, i32* %2
%73 = or i32 %72, %71
store i32 %73, i32* %2
%74 = call i32 @system(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
%75 = call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 %74, i32 0, i32 0, i32 0)
%76 = load i32, i32* %2
%77 = or i32 %76, %75
store i32 %77, i32* %2
%78 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
%79 = call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %78, i32 0, i32 0, i32 0)
%80 = load i32, i32* %2
%81 = or i32 %80, %79
store i32 %81, i32* %2
%82 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0))
%83 = call i32 @do_test(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0), i32 %82, i32 0, i32 0, i32 0)
%84 = load i32, i32* %2
%85 = or i32 %84, %83
store i32 %85, i32* %2
%86 = load i32, i32* %2
store i32 %86, i32* %1
br label %87
87: ; preds = %53, %51, %34
%88 = load i32, i32* %1
ret i32 %88
}

LLVM IR (-O2):
@.str = [37 x i8] c"Test 1. Module insertion and removal\00"
@.str.1 = [34 x i8] c"insmod uart16550, default options\00"
@.str.2 = [20 x i8] c"insmod uart16550.ko\00"
@.str.3 = [6 x i8] c"major\00"
@.str.4 = [56 x i8] c"cat /proc/devices | grep '42 uart16550' >/dev/null 2>&1\00"
@.str.5 = [13 x i8] c"ioports COM1\00"
@.str.6 = [66 x i8] c"cat /proc/ioports | grep '03f8-03ff : uart16550' > /dev/null 2>&1\00"
@.str.7 = [13 x i8] c"ioports COM2\00"
@.str.8 = [66 x i8] c"cat /proc/ioports | grep '02f8-02ff : uart16550' > /dev/null 2>&1\00"
@.str.9 = [16 x i8] c"interrupts COM1\00"
@.str.10 = [61 x i8] c"cat /proc/interrupts | grep '4:.*uart16550' > /dev/null 2>&1\00"
@.str.11 = [16 x i8] c"interrupts COM2\00"
@.str.12 = [61 x i8] c"cat /proc/interrupts | grep '3:.*uart16550' > /dev/null 2>&1\00"
@.str.13 = [6 x i8] c"rmmod\00"
@.str.14 = [16 x i8] c"rmmod uart16550\00"
@.str.15 = [27 x i8] c"insmod uart16550, major=42\00"
@.str.16 = [29 x i8] c"insmod uart16550.ko major=42\00"
@.str.17 = [28 x i8] c"insmod uart16550, COM2 only\00"
@.str.18 = [29 x i8] c"insmod uart16550.ko option=2\00"
@.str.19 = [27 x i8] c"insmod solution, COM1 only\00"
@.str.20 = [28 x i8] c"insmod solution.ko option=1\00"
@.str.21 = [65 x i8] c"cat /proc/ioports | grep '03f8-03ff : solution' > /dev/null 2>&1\00"
@.str.22 = [60 x i8] c"cat /proc/interrupts | grep '4:.*solution' > /dev/null 2>&1\00"
@.str.23 = [15 x i8] c"rmmod solution\00"
define i32 @test1() {
%1 = tail call i32 @test_title(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @do_test(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 0, i32 0, i32 1)
%4 = tail call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%5 = tail call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %4, i32 0, i32 0, i32 0)
%6 = or i32 %5, %3
%7 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %7, i32 0, i32 0, i32 0)
%9 = or i32 %6, %8
%10 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%11 = tail call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %10, i32 0, i32 0, i32 0)
%12 = or i32 %9, %11
%13 = tail call i32 @system(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0))
%14 = tail call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %13, i32 0, i32 0, i32 0)
%15 = or i32 %12, %14
%16 = tail call i32 @system(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
%17 = tail call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 %16, i32 0, i32 0, i32 0)
%18 = or i32 %15, %17
%19 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
%20 = tail call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %19, i32 0, i32 0, i32 0)
%21 = or i32 %18, %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %57
23: ; preds = %0
%24 = tail call i32 @system(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.16, i64 0, i64 0))
%25 = tail call i32 @do_test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i32 %24, i32 0, i32 0, i32 1)
%26 = tail call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%27 = tail call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 0, i32 0, i32 0)
%28 = or i32 %27, %25
%29 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
%30 = tail call i32 @do_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %29, i32 0, i32 0, i32 0)
%31 = or i32 %28, %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %57
33: ; preds = %23
%34 = tail call i32 @system(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0))
%35 = tail call i32 @do_test(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0), i32 %34, i32 0, i32 0, i32 1)
%36 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
%37 = tail call i32 @do_test(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0), i32 %36, i32 0, i32 0, i32 1)
%38 = or i32 %37, %35
%39 = tail call i32 @system(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.21, i64 0, i64 0))
%40 = tail call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %39, i32 0, i32 0, i32 0)
%41 = or i32 %38, %40
%42 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%43 = tail call i32 @do_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %42, i32 0, i32 0, i32 0)
%44 = or i32 %41, %43
%45 = tail call i32 @system(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.22, i64 0, i64 0))
%46 = tail call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %45, i32 0, i32 0, i32 0)
%47 = or i32 %44, %46
%48 = tail call i32 @system(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0))
%49 = tail call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 %48, i32 0, i32 0, i32 0)
%50 = or i32 %47, %49
%51 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
%52 = tail call i32 @do_test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %51, i32 0, i32 0, i32 0)
%53 = or i32 %50, %52
%54 = tail call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0))
%55 = tail call i32 @do_test(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0), i32 %54, i32 0, i32 0, i32 0)
%56 = or i32 %53, %55
br label %57
57: ; preds = %23, %0, %33
%58 = phi i32 [ %56, %33 ], [ %21, %0 ], [ %31, %23 ]
ret i32 %58
}