#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 generic_test(char const *, char const *, int, int);
int rand();
int /*<<< orphan*/ test_title(char *);
int test8(void) {
  const char *rd, *wr;
  do {
    int r = rand() % 2;
    if (r == 0) {
      rd = "uart16550";
      wr = "solution";
    } else {
      rd = "solution";
      wr = "uart16550";
    }
  } while (0);
  test_title("Test 8. Read/Write, high speed");
  return generic_test(rd, wr, 2, 5);
}


x86 assembly (clang, -O0):
<test8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    116f <test8+0x3f>
lea    0xea5(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1185 <test8+0x55>
lea    0xe94(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe7f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    118a <test8+0x5a>
lea    0xe82(%rip),%rdi
call   1040 <test_title@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
mov    $0x5,%ecx
call   1030 <generic_test@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test8>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <rand@plt>
test   $0x1,%al
lea    0xec6(%rip),%rbx
lea    0xeb5(%rip),%rax
mov    %rax,%r14
cmove  %rbx,%r14
cmove  %rax,%rbx
lea    0xeb6(%rip),%rdi
call   1040 <test_title@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
mov    $0x5,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <generic_test@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"uart16550\00"
@.str.1 = [9 x i8] c"solution\00"
@.str.2 = [31 x i8] c"Test 8. Read/Write, high speed\00"
define i32 @test8() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
br label %4
4: ; preds = %0
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 2
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %4
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
10: ; preds = %4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %11
11: ; preds = %10, %9
br label %12
12: ; preds = %11
%13 = call i32 @test_title(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%14 = load i8*, i8** %1
%15 = load i8*, i8** %2
%16 = call i32 @generic_test(i8* %14, i8* %15, i32 2, i32 5)
ret i32 %16
}

LLVM IR (-O2):
@.str = [10 x i8] c"uart16550\00"
@.str.1 = [9 x i8] c"solution\00"
@.str.2 = [31 x i8] c"Test 8. Read/Write, high speed\00"
define i32 @test8() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
%5 = select i1 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @test_title(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @generic_test(i8* %5, i8* %4, i32 2, i32 5)
ret i32 %7
}