#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*/ down(short *);
int /*<<< orphan*/ left(short *);
int /*<<< orphan*/ right(short *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ up(short *);
void update(short *board) {
  int n;
  scanf("%d", &n);
  if (n == 0)
    left(board);
  else if (n == 1)
    up(board);
  else if (n == 2)
    right(board);
  else
    down(board);
}


x86 assembly (clang, -O0):
<update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1184 <update+0x34>
mov    -0x8(%rbp),%rdi
call   1030 <left@plt>
jmp    11c7 <update+0x77>
cmpl   $0x1,-0xc(%rbp)
jne    119c <update+0x4c>
mov    -0x8(%rbp),%rdi
call   1060 <up@plt>
jmp    11c2 <update+0x72>
cmpl   $0x2,-0xc(%rbp)
jne    11b4 <update+0x64>
mov    -0x8(%rbp),%rdi
call   1040 <right@plt>
jmp    11bd <update+0x6d>
mov    -0x8(%rbp),%rdi
call   1050 <down@plt>
jmp    11c2 <update+0x72>
jmp    11c7 <update+0x77>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xea1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %rbx,%rdi
cmp    $0x2,%eax
je     1185 <update+0x35>
cmp    $0x1,%eax
je     118c <update+0x3c>
test   %eax,%eax
jne    1193 <update+0x43>
call   1030 <left@plt>
jmp    1198 <update+0x48>
call   1040 <right@plt>
jmp    1198 <update+0x48>
call   1060 <up@plt>
jmp    1198 <update+0x48>
call   1050 <down@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @update(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
store i16* %0, i16** %2
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i16*, i16** %2
%9 = call i32 @left(i16* %8)
br label %27
10: ; preds = %1
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i16*, i16** %2
%15 = call i32 @up(i16* %14)
br label %26
16: ; preds = %10
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i16*, i16** %2
%21 = call i32 @right(i16* %20)
br label %25
22: ; preds = %16
%23 = load i16*, i16** %2
%24 = call i32 @down(i16* %23)
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25, %13
br label %27
27: ; preds = %26, %7
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @update(i16* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
switch i32 %5, label %12 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
]
6: ; preds = %1
%7 = call i32 @left(i16* %0)
br label %14
8: ; preds = %1
%9 = call i32 @up(i16* %0)
br label %14
10: ; preds = %1
%11 = call i32 @right(i16* %0)
br label %14
12: ; preds = %1
%13 = call i32 @down(i16* %0)
br label %14
14: ; preds = %8, %12, %10, %6
ret void
}