void getmove(board) int board[];
{
  int Move;
  int ItemsRead;
  char dumc;
  do {
    do {
      printf("Your move: ");
      ItemsRead = scanf("%d", &Move);
      if (ItemsRead == 0)
        scanf("%c", &dumc);
    } while (ItemsRead != 1);
  } while (board[Move]);
  board[Move] = 4;
  draw(board);
}


x86 assembly (clang, -O0):
<getmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1141 <getmove+0x11>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1180 <getmove+0x50>
lea    0xe9a(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
jmp    1185 <getmove+0x55>
cmpl   $0x1,-0x10(%rbp)
jne    1141 <getmove+0x11>
jmp    1194 <getmove+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    113c <getmove+0xc>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x4,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <draw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmove>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xebb(%rip),%r15
lea    0xec0(%rip),%r12
lea    0x4(%rsp),%rbx
lea    0xeb7(%rip),%r13
lea    0x3(%rsp),%rbp
jmp    116c <getmove+0x3c>
nop
movslq 0x4(%rsp),%rax
cmpl   $0x0,(%r14,%rax,4)
je     119b <getmove+0x6b>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1160 <getmove+0x30>
test   %eax,%eax
jne    116c <getmove+0x3c>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
jmp    116c <getmove+0x3c>
movl   $0x4,(%r14,%rax,4)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <draw@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Your move: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%c\00"
define void @getmove(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32* %0, i32** %2
br label %6
6: ; preds = %19, %1
br label %7
7: ; preds = %15, %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %14
14: ; preds = %12, %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 1
br i1 %17, label %7, label %18
18: ; preds = %15
br label %19
19: ; preds = %18
%20 = load i32*, i32** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %6, label %26
26: ; preds = %19
%27 = load i32*, i32** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 4, i32* %30
%31 = load i32*, i32** %2
%32 = call i32 (i32*, ...) bitcast (i32 (...)* @draw to i32 (i32*, ...)*)(i32* %31)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Your move: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%c\00"
define void @getmove(i32* %0) {
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %16, %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
switch i32 %7, label %16 [
i32 0, label %8
i32 1, label %10
]
8: ; preds = %5
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %16
10: ; preds = %5
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %10, %5, %8
br label %5
17: ; preds = %10
%18 = sext i32 %11 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
store i32 4, i32* %19
%20 = call i32 (i32*, ...) bitcast (i32 (...)* @draw to i32 (i32*, ...)*)(i32* %0)
ret void
}