#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 *);
int rand();
void print_comparison(int type) {
  switch (rand() % 8) {
  case 0:
    printf("~");
    break;
  case 1:
    printf("!=");
    break;
  case 2:
    printf("==");
    break;
  case 3:
    printf("<");
    break;
  case 4:
    printf("<=");
    break;
  case 5:
    printf(">");
    break;
  case 6:
    printf(">=");
    break;
  case 7:
    printf("&");
    break;
  }
}


x86 assembly (clang, -O0):
<print_comparison>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%edx
add    $0x7,%edx
test   %eax,%eax
mov    %eax,%ecx
cmovs  %edx,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     11e9 <print_comparison+0xc9>
mov    -0x10(%rbp),%rax
lea    0xea3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <print_comparison+0xc9>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_comparison>:
push   %rax
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cmp    $0x7,%eax
ja     1165 <print_comparison+0x35>
lea    0xeaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x7e,%edi
pop    %rax
jmp    1030 <putchar@plt>
pop    %rax
ret
lea    0xeb2(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>
lea    0xea8(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>
mov    $0x3c,%edi
pop    %rax
jmp    1030 <putchar@plt>
lea    0xe93(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>
mov    $0x3e,%edi
pop    %rax
jmp    1030 <putchar@plt>
lea    0xe7e(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>
mov    $0x26,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"~\00"
@.str.1 = [3 x i8] c"!=\00"
@.str.2 = [3 x i8] c"==\00"
@.str.3 = [2 x i8] c"<\00"
@.str.4 = [3 x i8] c"<=\00"
@.str.5 = [2 x i8] c">\00"
@.str.6 = [3 x i8] c">=\00"
@.str.7 = [2 x i8] c"&\00"
define void @print_comparison(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 8
switch i32 %4, label %21 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
]
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %21
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %21
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %21
15: ; preds = %1
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %21
17: ; preds = %1
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %21
19: ; preds = %1
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %21
21: ; preds = %1, %19, %17, %15, %13, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"!=\00"
@.str.2 = [3 x i8] c"==\00"
@.str.4 = [3 x i8] c"<=\00"
@.str.6 = [3 x i8] c">=\00"
define void @print_comparison(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 8
switch i32 %3, label %20 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
]
4: ; preds = %1
%5 = tail call i32 @putchar(i32 126)
br label %20
6: ; preds = %1
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %20
8: ; preds = %1
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %20
10: ; preds = %1
%11 = tail call i32 @putchar(i32 60)
br label %20
12: ; preds = %1
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %20
14: ; preds = %1
%15 = tail call i32 @putchar(i32 62)
br label %20
16: ; preds = %1
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %20
18: ; preds = %1
%19 = tail call i32 @putchar(i32 38)
br label %20
20: ; preds = %1, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}