#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();
float evaluate_score_black(char *board) {
  int i = 0;
  float score = 0.0f;
  char piece;
  for (i = 0; i < 64; i++) {
    piece = board[i];
    if (piece == 'p') {
      score = score + 1;
    } else if (piece == 'r') {
      score = score + 5;
    } else if (piece == 'n') {
      score = score + 5;
    } else if (piece == 'b') {
      score = score + 7;
    } else if (piece == 'q') {
      score = score + 9;
    } else if (piece == 'k') {
      score = score + 200;
    } else if (piece == 'P') {
      score = score - 1;
    } else if (piece == 'R') {
      score = score - 5;
    } else if (piece == 'N') {
      score = score - 5;
    } else if (piece == 'B') {
      score = score - 7;
    } else if (piece == 'Q') {
      score = score - 9;
    } else if (piece == 'K') {
      score = score - 200;
    }
  }
  float fluff = rand() % 100 / 100.0f;
  return score + fluff;
}


x86 assembly (clang, -O0):
<evaluate_score_black>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    1357 <evaluate_score_black+0x247>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x70,%eax
jne    116e <evaluate_score_black+0x5e>
movss  0xeb5(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1344 <evaluate_score_black+0x234>
movsbl -0x11(%rbp),%eax
cmp    $0x72,%eax
jne    1192 <evaluate_score_black+0x82>
movss  0xe8d(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    133f <evaluate_score_black+0x22f>
movsbl -0x11(%rbp),%eax
cmp    $0x6e,%eax
jne    11b6 <evaluate_score_black+0xa6>
movss  0xe69(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    133a <evaluate_score_black+0x22a>
movsbl -0x11(%rbp),%eax
cmp    $0x62,%eax
jne    11da <evaluate_score_black+0xca>
movss  0xe41(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1335 <evaluate_score_black+0x225>
movsbl -0x11(%rbp),%eax
cmp    $0x71,%eax
jne    11fe <evaluate_score_black+0xee>
movss  0xe19(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1330 <evaluate_score_black+0x220>
movsbl -0x11(%rbp),%eax
cmp    $0x6b,%eax
jne    1222 <evaluate_score_black+0x112>
movss  0xdf1(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    132b <evaluate_score_black+0x21b>
movsbl -0x11(%rbp),%eax
cmp    $0x50,%eax
jne    124a <evaluate_score_black+0x13a>
movss  -0x10(%rbp),%xmm0
movss  0xdd8(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1326 <evaluate_score_black+0x216>
movsbl -0x11(%rbp),%eax
cmp    $0x52,%eax
jne    1272 <evaluate_score_black+0x162>
movss  -0x10(%rbp),%xmm0
movss  0xdac(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1321 <evaluate_score_black+0x211>
movsbl -0x11(%rbp),%eax
cmp    $0x4e,%eax
jne    129a <evaluate_score_black+0x18a>
movss  -0x10(%rbp),%xmm0
movss  0xd84(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    131c <evaluate_score_black+0x20c>
movsbl -0x11(%rbp),%eax
cmp    $0x42,%eax
jne    12c2 <evaluate_score_black+0x1b2>
movss  -0x10(%rbp),%xmm0
movss  0xd58(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1317 <evaluate_score_black+0x207>
movsbl -0x11(%rbp),%eax
cmp    $0x51,%eax
jne    12ea <evaluate_score_black+0x1da>
movss  -0x10(%rbp),%xmm0
movss  0xd2c(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1312 <evaluate_score_black+0x202>
movsbl -0x11(%rbp),%eax
cmp    $0x4b,%eax
jne    130d <evaluate_score_black+0x1fd>
movss  -0x10(%rbp),%xmm0
movss  0xd00(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1312 <evaluate_score_black+0x202>
jmp    1317 <evaluate_score_black+0x207>
jmp    131c <evaluate_score_black+0x20c>
jmp    1321 <evaluate_score_black+0x211>
jmp    1326 <evaluate_score_black+0x216>
jmp    132b <evaluate_score_black+0x21b>
jmp    1330 <evaluate_score_black+0x220>
jmp    1335 <evaluate_score_black+0x225>
jmp    133a <evaluate_score_black+0x22a>
jmp    133f <evaluate_score_black+0x22f>
jmp    1344 <evaluate_score_black+0x234>
jmp    1349 <evaluate_score_black+0x239>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1132 <evaluate_score_black+0x22>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movss  0xc8e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_score_black>:
push   %rax
xorps  %xmm3,%xmm3
xor    %eax,%eax
lea    0xf0f(%rip),%rcx
movss  0xee2(%rip),%xmm8
movss  0xed1(%rip),%xmm9
movss  0xed5(%rip),%xmm2
movss  0xed0(%rip),%xmm10
movss  0xebc(%rip),%xmm4
movss  0xecc(%rip),%xmm5
movss  0xebc(%rip),%xmm6
movss  0xec0(%rip),%xmm7
movss  0xebc(%rip),%xmm0
movss  0xea8(%rip),%xmm1
jmp    118a <evaluate_score_black+0x7a>
addss  %xmm2,%xmm3
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rax
cmp    $0x40,%rax
je     11db <evaluate_score_black+0xcb>
movzbl (%rdi,%rax,1),%edx
add    $0xbe,%dl
cmp    $0x30,%dl
ja     1180 <evaluate_score_black+0x70>
movzbl %dl,%edx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
addss  %xmm7,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm8,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm9,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm10,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm4,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm5,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm6,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm0,%xmm3
jmp    1180 <evaluate_score_black+0x70>
addss  %xmm1,%xmm3
jmp    1180 <evaluate_score_black+0x70>
xor    %eax,%eax
movss  %xmm3,0x4(%rsp)
call   1030 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  0xe16(%rip),%xmm1
movss  0x4(%rsp),%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @evaluate_score_black(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca float
%5 = alloca i8
%6 = alloca float
store i8* %0, i8** %2
store i32 0, i32* %3
store float 0.000000e+00, float* %4
store i32 0, i32* %3
br label %7
7: ; preds = %111, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 64
br i1 %9, label %10, label %114
10: ; preds = %7
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
store i8 %15, i8* %5
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 112
br i1 %18, label %19, label %22
19: ; preds = %10
%20 = load float, float* %4
%21 = fadd float %20, 1.000000e+00
store float %21, float* %4
br label %110
22: ; preds = %10
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 114
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load float, float* %4
%28 = fadd float %27, 5.000000e+00
store float %28, float* %4
br label %109
29: ; preds = %22
%30 = load i8, i8* %5
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 110
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load float, float* %4
%35 = fadd float %34, 5.000000e+00
store float %35, float* %4
br label %108
36: ; preds = %29
%37 = load i8, i8* %5
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 98
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load float, float* %4
%42 = fadd float %41, 7.000000e+00
store float %42, float* %4
br label %107
43: ; preds = %36
%44 = load i8, i8* %5
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 113
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load float, float* %4
%49 = fadd float %48, 9.000000e+00
store float %49, float* %4
br label %106
50: ; preds = %43
%51 = load i8, i8* %5
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 107
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load float, float* %4
%56 = fadd float %55, 2.000000e+02
store float %56, float* %4
br label %105
57: ; preds = %50
%58 = load i8, i8* %5
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 80
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load float, float* %4
%63 = fsub float %62, 1.000000e+00
store float %63, float* %4
br label %104
64: ; preds = %57
%65 = load i8, i8* %5
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 82
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load float, float* %4
%70 = fsub float %69, 5.000000e+00
store float %70, float* %4
br label %103
71: ; preds = %64
%72 = load i8, i8* %5
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 78
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = load float, float* %4
%77 = fsub float %76, 5.000000e+00
store float %77, float* %4
br label %102
78: ; preds = %71
%79 = load i8, i8* %5
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 66
br i1 %81, label %82, label %85
82: ; preds = %78
%83 = load float, float* %4
%84 = fsub float %83, 7.000000e+00
store float %84, float* %4
br label %101
85: ; preds = %78
%86 = load i8, i8* %5
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %87, 81
br i1 %88, label %89, label %92
89: ; preds = %85
%90 = load float, float* %4
%91 = fsub float %90, 9.000000e+00
store float %91, float* %4
br label %100
92: ; preds = %85
%93 = load i8, i8* %5
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 75
br i1 %95, label %96, label %99
96: ; preds = %92
%97 = load float, float* %4
%98 = fsub float %97, 2.000000e+02
store float %98, float* %4
br label %99
99: ; preds = %96, %92
br label %100
100: ; preds = %99, %89
br label %101
101: ; preds = %100, %82
br label %102
102: ; preds = %101, %75
br label %103
103: ; preds = %102, %68
br label %104
104: ; preds = %103, %61
br label %105
105: ; preds = %104, %54
br label %106
106: ; preds = %105, %47
br label %107
107: ; preds = %106, %40
br label %108
108: ; preds = %107, %33
br label %109
109: ; preds = %108, %26
br label %110
110: ; preds = %109, %19
br label %111
111: ; preds = %110
%112 = load i32, i32* %3
%113 = add nsw i32 %112, 1
store i32 %113, i32* %3
br label %7
114: ; preds = %7
%115 = call i32 (...) @rand()
%116 = srem i32 %115, 100
%117 = sitofp i32 %116 to float
%118 = fdiv float %117, 1.000000e+02
store float %118, float* %6
%119 = load float, float* %4
%120 = load float, float* %6
%121 = fadd float %119, %120
ret float %121
}

LLVM IR (-O2):
define float @evaluate_score_black(i8* nocapture %0) {
br label %2
2: ; preds = %1, %31
%3 = phi i64 [ 0, %1 ], [ %33, %31 ]
%4 = phi float [ 0.000000e+00, %1 ], [ %32, %31 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %31 [
i8 112, label %7
i8 114, label %9
i8 110, label %11
i8 98, label %13
i8 113, label %15
i8 107, label %17
i8 80, label %19
i8 82, label %21
i8 78, label %23
i8 66, label %25
i8 81, label %27
i8 75, label %29
]
7: ; preds = %2
%8 = fadd float %4, 1.000000e+00
br label %31
9: ; preds = %2
%10 = fadd float %4, 5.000000e+00
br label %31
11: ; preds = %2
%12 = fadd float %4, 5.000000e+00
br label %31
13: ; preds = %2
%14 = fadd float %4, 7.000000e+00
br label %31
15: ; preds = %2
%16 = fadd float %4, 9.000000e+00
br label %31
17: ; preds = %2
%18 = fadd float %4, 2.000000e+02
br label %31
19: ; preds = %2
%20 = fadd float %4, -1.000000e+00
br label %31
21: ; preds = %2
%22 = fadd float %4, -5.000000e+00
br label %31
23: ; preds = %2
%24 = fadd float %4, -5.000000e+00
br label %31
25: ; preds = %2
%26 = fadd float %4, -7.000000e+00
br label %31
27: ; preds = %2
%28 = fadd float %4, -9.000000e+00
br label %31
29: ; preds = %2
%30 = fadd float %4, -2.000000e+02
br label %31
31: ; preds = %2, %7, %11, %15, %19, %23, %27, %29, %25, %21, %17, %13, %9
%32 = phi float [ %8, %7 ], [ %10, %9 ], [ %12, %11 ], [ %14, %13 ], [ %16, %15 ], [ %18, %17 ], [ %20, %19 ], [ %22, %21 ], [ %24, %23 ], [ %26, %25 ], [ %28, %27 ], [ %30, %29 ], [ %4, %2 ]
%33 = add nuw nsw i64 %3, 1
%34 = icmp eq i64 %33, 64
br i1 %34, label %35, label %2
35: ; preds = %31
%36 = tail call i32 (...) @rand()
%37 = srem i32 %36, 100
%38 = sitofp i32 %37 to float
%39 = fdiv float %38, 1.000000e+02
%40 = fadd float %32, %39
ret float %40
}