#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*/ updatepins(int, int);
int /*<<< orphan*/ write_score(int, int, int);
void fillinscore(int score, int round, int player) {
  int columnwidth = 30;
  int columnlength = 4;
  round = round / 2;
  round++;
  if (player == 0) {
    int offset = 1;
    int roundoffset = (round - 1) * 30 / 4;
    write_score(roundoffset + offset, (146) / 4 + offset, score);
  } else if (player == 1) {
    int offset = 1;
    int roundoffset = (round - 1) * 30 / 4;
    write_score(roundoffset + offset, 146 / 4 + offset + columnlength, score);
  }
  updatepins(score, round);
}


x86 assembly (clang, -O0):
<fillinscore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x1e,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1194 <fillinscore+0x74>
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
imul   $0x1e,%eax,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
add    -0x18(%rbp),%edi
mov    -0x18(%rbp),%esi
add    $0x24,%esi
mov    -0x4(%rbp),%edx
call   1030 <write_score@plt>
jmp    11d5 <fillinscore+0xb5>
cmpl   $0x1,-0xc(%rbp)
jne    11d0 <fillinscore+0xb0>
movl   $0x1,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
imul   $0x1e,%eax,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
add    -0x20(%rbp),%edi
mov    -0x20(%rbp),%esi
add    $0x24,%esi
add    -0x14(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1030 <write_score@plt>
jmp    11d5 <fillinscore+0xb5>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <updatepins@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillinscore>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
test   %edx,%edx
je     113e <fillinscore+0x1e>
cmp    $0x1,%edx
jne    1161 <fillinscore+0x41>
mov    $0x29,%esi
jmp    1143 <fillinscore+0x23>
mov    $0x25,%esi
mov    %ebp,%eax
shl    $0x5,%eax
sub    %ebp,%eax
sub    %ebp,%eax
lea    0x3(%rax),%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x2,%edi
add    $0x1,%edi
mov    %ebx,%edx
call   1030 <write_score@plt>
add    $0x1,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <updatepins@plt>

LLVM IR (-O0):
define void @fillinscore(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 30, i32* %7
store i32 4, i32* %8
%13 = load i32, i32* %5
%14 = sdiv i32 %13, 2
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %31
19: ; preds = %3
store i32 1, i32* %9
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = mul nsw i32 %21, 30
%23 = sdiv i32 %22, 4
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = load i32, i32* %9
%26 = add nsw i32 %24, %25
%27 = load i32, i32* %9
%28 = add nsw i32 36, %27
%29 = load i32, i32* %4
%30 = call i32 @write_score(i32 %26, i32 %28, i32 %29)
br label %49
31: ; preds = %3
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %48
34: ; preds = %31
store i32 1, i32* %11
%35 = load i32, i32* %5
%36 = sub nsw i32 %35, 1
%37 = mul nsw i32 %36, 30
%38 = sdiv i32 %37, 4
store i32 %38, i32* %12
%39 = load i32, i32* %12
%40 = load i32, i32* %11
%41 = add nsw i32 %39, %40
%42 = load i32, i32* %11
%43 = add nsw i32 36, %42
%44 = load i32, i32* %8
%45 = add nsw i32 %43, %44
%46 = load i32, i32* %4
%47 = call i32 @write_score(i32 %41, i32 %45, i32 %46)
br label %48
48: ; preds = %34, %31
br label %49
49: ; preds = %48, %19
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = call i32 @updatepins(i32 %50, i32 %51)
ret void
}

LLVM IR (-O2):
define void @fillinscore(i32 %0, i32 %1, i32 %2) {
%4 = sdiv i32 %1, 2
switch i32 %2, label %12 [
i32 0, label %6
i32 1, label %5
]
5: ; preds = %3
br label %6
6: ; preds = %3, %5
%7 = phi i32 [ 41, %5 ], [ 37, %3 ]
%8 = mul nsw i32 %4, 30
%9 = sdiv i32 %8, 4
%10 = add nsw i32 %9, 1
%11 = tail call i32 @write_score(i32 %10, i32 %7, i32 %0)
br label %12
12: ; preds = %6, %3
%13 = add nsw i32 %4, 1
%14 = tail call i32 @updatepins(i32 %0, i32 %13)
ret void
}