#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 rand();
int getHareMove() {
  int randomNum = rand() % 1000;
  if (randomNum >= 800)
    return 0;
  else if (randomNum >= 600)
    return 9;
  else if (randomNum >= 500)
    return -12;
  else if (randomNum >= 200)
    return 1;
  else
    return -2;
}


x86 assembly (clang, -O0):
<getHareMove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x320,-0x8(%rbp)
jl     1143 <getHareMove+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1195 <getHareMove+0x85>
cmpl   $0x258,-0x8(%rbp)
jl     115c <getHareMove+0x4c>
movl   $0x9,-0x4(%rbp)
jmp    1195 <getHareMove+0x85>
cmpl   $0x1f4,-0x8(%rbp)
jl     1175 <getHareMove+0x65>
movl   $0xfffffff4,-0x4(%rbp)
jmp    1195 <getHareMove+0x85>
cmpl   $0xc8,-0x8(%rbp)
jl     118e <getHareMove+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    1195 <getHareMove+0x85>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHareMove>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
cmp    $0x31f,%eax
jg     1167 <getHareMove+0x57>
mov    $0x9,%ebx
cmp    $0x257,%eax
jg     1167 <getHareMove+0x57>
mov    $0xfffffff4,%ebx
cmp    $0x1f3,%eax
jg     1167 <getHareMove+0x57>
xor    %ecx,%ecx
cmp    $0xc8,%eax
setge  %cl
lea    (%rcx,%rcx,2),%ebx
add    $0xfffffffe,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getHareMove() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 1000
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 800
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 0, i32* %1
br label %21
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 600
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 9, i32* %1
br label %21
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 500
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 -12, i32* %1
br label %21
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 200
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 1, i32* %1
br label %21
20: ; preds = %16
store i32 -2, i32* %1
br label %21
21: ; preds = %20, %19, %15, %11, %7
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
define i32 @getHareMove() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 1000
%3 = icmp sgt i32 %2, 799
br i1 %3, label %11, label %4
4: ; preds = %0
%5 = icmp sgt i32 %2, 599
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = icmp sgt i32 %2, 499
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = icmp sgt i32 %2, 199
%10 = select i1 %9, i32 1, i32 -2
br label %11
11: ; preds = %8, %6, %4, %0
%12 = phi i32 [ 0, %0 ], [ 9, %4 ], [ -12, %6 ], [ %10, %8 ]
ret i32 %12
}