#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 */
typedef enum board { ____Placeholder_board } board;

/* Variables and functions */
int /*<<< orphan*/ millisleep(int);
scalar_t__ occupied(int *, unsigned int);
int /*<<< orphan*/ printf(char *, ...);
size_t rand();
unsigned bot_ask_coord(enum board *b, size_t board_size) {
  unsigned coord;
  printf("Okay bot, where do you want to mark?\n");
  do {
    coord = rand() % board_size;
  } while (occupied(b, coord));
  millisleep(400);
  printf("%u\n", coord + 1);
  return coord;
}


x86 assembly (clang, -O0):
<bot_ask_coord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <rand@plt>
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <occupied@plt>
cmp    $0x0,%rax
jne    115e <bot_ask_coord+0x1e>
mov    $0x190,%edi
call   1050 <millisleep@plt>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_ask_coord>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
jmp    1187 <bot_ask_coord+0x37>
nopl   0x0(%rax)
xor    %edx,%edx
div    %r15
mov    %rdx,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <occupied@plt>
test   %rax,%rax
je     11a3 <bot_ask_coord+0x53>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %rax,%rcx
or     %r15,%rcx
shr    $0x20,%rcx
jne    1170 <bot_ask_coord+0x20>
xor    %edx,%edx
div    %r15d
mov    %edx,%ebx
jmp    1178 <bot_ask_coord+0x28>
mov    $0x190,%edi
call   1060 <millisleep@plt>
lea    0x1(%rbx),%esi
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Okay bot, where do you want to mark?\0A\00"
@.str.1 = [4 x i8] c"%u\0A\00"
define i32 @bot_ask_coord(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %12, %2
%8 = call i64 (...) @rand()
%9 = load i64, i64* %4
%10 = urem i64 %8, %9
%11 = trunc i64 %10 to i32
store i32 %11, i32* %5
br label %12
12: ; preds = %7
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = call i64 @occupied(i32* %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %7, label %17
17: ; preds = %12
%18 = call i32 @millisleep(i32 400)
%19 = load i32, i32* %5
%20 = add i32 %19, 1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%u\0A\00"
@str = [37 x i8] c"Okay bot, where do you want to mark?\00"
define i32 @bot_ask_coord(i32* %0, i64 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %4, %2
%5 = tail call i64 (...) @rand()
%6 = urem i64 %5, %1
%7 = trunc i64 %6 to i32
%8 = tail call i64 @occupied(i32* %0, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
%12 = tail call i32 @millisleep(i32 400)
%13 = add i32 %11, 1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i32 %11
}