int percentSolved(int board[][9]) {
  int r, c;
  float percent = 0;
  for (r = 0; r < 9; r++) {
    for (c = 0; c < 9; c++) {
      if (board[r][c] != -1)
        percent += 1.f / (9 * 9);
    }
  }
  return (int)(percent * 100 + 0.5);
}


x86 assembly (clang, -O0):
<percentSolved>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1187 <percentSolved+0x87>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    1174 <percentSolved+0x74>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1161 <percentSolved+0x61>
movss  0xeb5(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1166 <percentSolved+0x66>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1128 <percentSolved+0x28>
jmp    1179 <percentSolved+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <percentSolved+0x17>
movss  0xe79(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe60(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<percentSolved>:
xorps  %xmm0,%xmm0
mov    $0x4,%eax
movss  0xef0(%rip),%xmm1
pcmpeqd %xmm2,%xmm2
jmp    1130 <percentSolved+0x30>
cs nopw 0x0(%rax,%rax,1)
add    $0x24,%rax
cmp    $0x148,%rax
je     11dc <percentSolved+0xdc>
cmpl   $0xffffffff,-0x4(%rdi,%rax,1)
je     113b <percentSolved+0x3b>
addss  %xmm1,%xmm0
movdqu (%rdi,%rax,1),%xmm3
movdqu 0x10(%rdi,%rax,1),%xmm4
pcmpeqd %xmm2,%xmm4
pcmpeqd %xmm2,%xmm3
packssdw %xmm4,%xmm3
packsswb %xmm3,%xmm3
pmovmskb %xmm3,%ecx
test   $0x1,%cl
je     1190 <percentSolved+0x90>
test   $0x2,%cl
je     1199 <percentSolved+0x99>
test   $0x4,%cl
je     11a2 <percentSolved+0xa2>
test   $0x8,%cl
je     11ab <percentSolved+0xab>
test   $0x10,%cl
je     11b4 <percentSolved+0xb4>
test   $0x20,%cl
je     11bd <percentSolved+0xbd>
test   $0x40,%cl
je     11c6 <percentSolved+0xc6>
test   $0x80,%cl
jne    1120 <percentSolved+0x20>
jmp    11d3 <percentSolved+0xd3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addss  %xmm1,%xmm0
test   $0x2,%cl
jne    1164 <percentSolved+0x64>
addss  %xmm1,%xmm0
test   $0x4,%cl
jne    1169 <percentSolved+0x69>
addss  %xmm1,%xmm0
test   $0x8,%cl
jne    116e <percentSolved+0x6e>
addss  %xmm1,%xmm0
test   $0x10,%cl
jne    1173 <percentSolved+0x73>
addss  %xmm1,%xmm0
test   $0x20,%cl
jne    1178 <percentSolved+0x78>
addss  %xmm1,%xmm0
test   $0x40,%cl
jne    117d <percentSolved+0x7d>
addss  %xmm1,%xmm0
test   $0x80,%cl
jne    1120 <percentSolved+0x20>
addss  %xmm1,%xmm0
jmp    1120 <percentSolved+0x20>
mulss  0xe20(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe18(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @percentSolved([9 x i32]* %0) {
%2 = alloca [9 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store [9 x i32]* %0, [9 x i32]** %2
store float 0.000000e+00, float* %5
store i32 0, i32* %3
br label %6
6: ; preds = %31, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %34
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %27, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 9
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load [9 x i32]*, [9 x i32]** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [9 x i32], [9 x i32]* %14, i64 %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %17, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %13
%24 = load float, float* %5
%25 = fadd float %24, 0x3F8948B100000000
store float %25, float* %5
br label %26
26: ; preds = %23, %13
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %10
30: ; preds = %10
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %6
34: ; preds = %6
%35 = load float, float* %5
%36 = fmul float %35, 1.000000e+02
%37 = fpext float %36 to double
%38 = fadd double %37, 5.000000e-01
%39 = fptosi double %38 to i32
ret i32 %39
}

LLVM IR (-O2):
define i32 @percentSolved([9 x i32]* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %38, %2 ]
%4 = phi float [ 0.000000e+00, %1 ], [ %37, %2 ]
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %3, i64 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, -1
%8 = fadd float %4, 0x3F8948B100000000
%9 = select i1 %7, float %4, float %8
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %3, i64 1
%11 = fadd float %9, 0x3F8948B100000000
%12 = bitcast i32* %10 to <8 x i32>*
%13 = load <8 x i32>, <8 x i32>* %12
%14 = icmp eq <8 x i32> %13, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
%15 = extractelement <8 x i1> %14, i64 0
%16 = select i1 %15, float %9, float %11
%17 = fadd float %16, 0x3F8948B100000000
%18 = extractelement <8 x i1> %14, i64 1
%19 = select i1 %18, float %16, float %17
%20 = fadd float %19, 0x3F8948B100000000
%21 = extractelement <8 x i1> %14, i64 2
%22 = select i1 %21, float %19, float %20
%23 = fadd float %22, 0x3F8948B100000000
%24 = extractelement <8 x i1> %14, i64 3
%25 = select i1 %24, float %22, float %23
%26 = fadd float %25, 0x3F8948B100000000
%27 = extractelement <8 x i1> %14, i64 4
%28 = select i1 %27, float %25, float %26
%29 = fadd float %28, 0x3F8948B100000000
%30 = extractelement <8 x i1> %14, i64 5
%31 = select i1 %30, float %28, float %29
%32 = fadd float %31, 0x3F8948B100000000
%33 = extractelement <8 x i1> %14, i64 6
%34 = select i1 %33, float %31, float %32
%35 = fadd float %34, 0x3F8948B100000000
%36 = extractelement <8 x i1> %14, i64 7
%37 = select i1 %36, float %34, float %35
%38 = add nuw nsw i64 %3, 1
%39 = icmp eq i64 %38, 9
br i1 %39, label %40, label %2
40: ; preds = %2
%41 = fmul float %37, 1.000000e+02
%42 = fpext float %41 to double
%43 = fadd double %42, 5.000000e-01
%44 = fptosi double %43 to i32
ret i32 %44
}