int count_missing(int sudoku[9][9]) {
  int v;
  int h;
  int c;
  v = 9;
  c = 0;
  while (v--) {
    h = 9;
    while (h--) {
      if (!sudoku[v][h])
        c++;
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<count_missing>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x9,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1175 <count_missing+0x75>
movl   $0x9,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     1170 <count_missing+0x70>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    116b <count_missing+0x6b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <count_missing+0x31>
jmp    1116 <count_missing+0x16>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_missing>:
movdqu 0x124(%rdi),%xmm1
movdqu 0x134(%rdi),%xmm2
pxor   %xmm0,%xmm0
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%ecx
shr    %cl
and    $0x55,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
movzbl %cl,%ecx
cmpl   $0x1,0x120(%rdi)
adc    $0x0,%ecx
movdqu 0x100(%rdi),%xmm1
movdqu 0x110(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%al
mov    %eax,%edx
and    $0x33,%dl
shr    $0x2,%al
and    $0x33,%al
add    %dl,%al
mov    %eax,%edx
shr    $0x4,%dl
add    %al,%dl
and    $0xf,%dl
movzbl %dl,%eax
cmpl   $0x1,0xfc(%rdi)
adc    $0x0,%eax
add    %ecx,%eax
movdqu 0xdc(%rdi),%xmm1
movdqu 0xec(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
cmpl   $0x1,0xd8(%rdi)
adc    $0x0,%ecx
add    %eax,%ecx
movdqu 0xb8(%rdi),%xmm1
movdqu 0xc8(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%al
mov    %eax,%edx
and    $0x33,%dl
shr    $0x2,%al
and    $0x33,%al
add    %dl,%al
mov    %eax,%edx
shr    $0x4,%dl
add    %al,%dl
and    $0xf,%dl
movzbl %dl,%eax
cmpl   $0x1,0xb4(%rdi)
adc    $0x0,%eax
add    %ecx,%eax
movdqu 0x94(%rdi),%xmm1
movdqu 0xa4(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
cmpl   $0x1,0x90(%rdi)
adc    $0x0,%ecx
add    %eax,%ecx
movdqu 0x70(%rdi),%xmm1
movdqu 0x80(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%al
mov    %eax,%edx
and    $0x33,%dl
shr    $0x2,%al
and    $0x33,%al
add    %dl,%al
mov    %eax,%edx
shr    $0x4,%dl
add    %al,%dl
and    $0xf,%dl
movzbl %dl,%eax
cmpl   $0x1,0x6c(%rdi)
adc    $0x0,%eax
add    %ecx,%eax
movdqu 0x4c(%rdi),%xmm1
movdqu 0x5c(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
cmpl   $0x1,0x48(%rdi)
adc    $0x0,%ecx
add    %eax,%ecx
movdqu 0x28(%rdi),%xmm1
movdqu 0x38(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%al
mov    %eax,%edx
and    $0x33,%dl
shr    $0x2,%al
and    $0x33,%al
add    %dl,%al
mov    %eax,%edx
shr    $0x4,%dl
add    %al,%dl
and    $0xf,%dl
movzbl %dl,%edx
cmpl   $0x1,0x24(%rdi)
adc    $0x0,%edx
add    %ecx,%edx
movdqu 0x4(%rdi),%xmm1
movdqu 0x14(%rdi),%xmm2
pcmpeqd %xmm0,%xmm2
pcmpeqd %xmm0,%xmm1
packssdw %xmm2,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%ecx
shr    %cl
and    $0x55,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
cmpl   $0x1,(%rdi)
movzbl %cl,%eax
adc    $0x0,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @count_missing([9 x i32]* %0) {
%2 = alloca [9 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store [9 x i32]* %0, [9 x i32]** %2
store i32 9, i32* %3
store i32 0, i32* %5
br label %6
6: ; preds = %29, %1
%7 = load i32, i32* %3
%8 = add nsw i32 %7, -1
store i32 %8, i32* %3
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %30
10: ; preds = %6
store i32 9, i32* %4
br label %11
11: ; preds = %28, %10
%12 = load i32, i32* %4
%13 = add nsw i32 %12, -1
store i32 %13, i32* %4
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load [9 x i32]*, [9 x i32]** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %16, i64 %18
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [9 x i32], [9 x i32]* %19, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %15
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %28
28: ; preds = %25, %15
br label %11
29: ; preds = %11
br label %6
30: ; preds = %6
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @count_missing([9 x i32]* nocapture %0) {
%2 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 8, i64 1
%3 = bitcast i32* %2 to <8 x i32>*
%4 = load <8 x i32>, <8 x i32>* %3
%5 = icmp eq <8 x i32> %4, zeroinitializer
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 8, i64 0
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = bitcast <8 x i1> %5 to i8
%11 = call i8 @llvm.ctpop.i8(i8 %10)
%12 = zext i8 %11 to i32
%13 = add nuw nsw i32 %12, %9
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 7, i64 1
%15 = bitcast i32* %14 to <8 x i32>*
%16 = load <8 x i32>, <8 x i32>* %15
%17 = icmp eq <8 x i32> %16, zeroinitializer
%18 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 7, i64 0
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = bitcast <8 x i1> %17 to i8
%23 = call i8 @llvm.ctpop.i8(i8 %22)
%24 = zext i8 %23 to i32
%25 = add nuw nsw i32 %24, %21
%26 = add nuw nsw i32 %25, %13
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 6, i64 1
%28 = bitcast i32* %27 to <8 x i32>*
%29 = load <8 x i32>, <8 x i32>* %28
%30 = icmp eq <8 x i32> %29, zeroinitializer
%31 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 6, i64 0
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = bitcast <8 x i1> %30 to i8
%36 = call i8 @llvm.ctpop.i8(i8 %35)
%37 = zext i8 %36 to i32
%38 = add nuw nsw i32 %37, %34
%39 = add nuw nsw i32 %38, %26
%40 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 5, i64 1
%41 = bitcast i32* %40 to <8 x i32>*
%42 = load <8 x i32>, <8 x i32>* %41
%43 = icmp eq <8 x i32> %42, zeroinitializer
%44 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 5, i64 0
%45 = load i32, i32* %44
%46 = icmp eq i32 %45, 0
%47 = zext i1 %46 to i32
%48 = bitcast <8 x i1> %43 to i8
%49 = call i8 @llvm.ctpop.i8(i8 %48)
%50 = zext i8 %49 to i32
%51 = add nuw nsw i32 %50, %47
%52 = add nuw nsw i32 %51, %39
%53 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 4, i64 1
%54 = bitcast i32* %53 to <8 x i32>*
%55 = load <8 x i32>, <8 x i32>* %54
%56 = icmp eq <8 x i32> %55, zeroinitializer
%57 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 4, i64 0
%58 = load i32, i32* %57
%59 = icmp eq i32 %58, 0
%60 = zext i1 %59 to i32
%61 = bitcast <8 x i1> %56 to i8
%62 = call i8 @llvm.ctpop.i8(i8 %61)
%63 = zext i8 %62 to i32
%64 = add nuw nsw i32 %63, %60
%65 = add nuw nsw i32 %64, %52
%66 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 3, i64 1
%67 = bitcast i32* %66 to <8 x i32>*
%68 = load <8 x i32>, <8 x i32>* %67
%69 = icmp eq <8 x i32> %68, zeroinitializer
%70 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 3, i64 0
%71 = load i32, i32* %70
%72 = icmp eq i32 %71, 0
%73 = zext i1 %72 to i32
%74 = bitcast <8 x i1> %69 to i8
%75 = call i8 @llvm.ctpop.i8(i8 %74)
%76 = zext i8 %75 to i32
%77 = add nuw nsw i32 %76, %73
%78 = add nuw nsw i32 %77, %65
%79 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 2, i64 1
%80 = bitcast i32* %79 to <8 x i32>*
%81 = load <8 x i32>, <8 x i32>* %80
%82 = icmp eq <8 x i32> %81, zeroinitializer
%83 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 2, i64 0
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, 0
%86 = zext i1 %85 to i32
%87 = bitcast <8 x i1> %82 to i8
%88 = call i8 @llvm.ctpop.i8(i8 %87)
%89 = zext i8 %88 to i32
%90 = add nuw nsw i32 %89, %86
%91 = add nuw nsw i32 %90, %78
%92 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 1, i64 1
%93 = bitcast i32* %92 to <8 x i32>*
%94 = load <8 x i32>, <8 x i32>* %93
%95 = icmp eq <8 x i32> %94, zeroinitializer
%96 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 1, i64 0
%97 = load i32, i32* %96
%98 = icmp eq i32 %97, 0
%99 = zext i1 %98 to i32
%100 = bitcast <8 x i1> %95 to i8
%101 = call i8 @llvm.ctpop.i8(i8 %100)
%102 = zext i8 %101 to i32
%103 = add nuw nsw i32 %102, %99
%104 = add nuw nsw i32 %103, %91
%105 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 0, i64 1
%106 = bitcast i32* %105 to <8 x i32>*
%107 = load <8 x i32>, <8 x i32>* %106
%108 = icmp eq <8 x i32> %107, zeroinitializer
%109 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 0, i64 0
%110 = load i32, i32* %109
%111 = icmp eq i32 %110, 0
%112 = zext i1 %111 to i32
%113 = bitcast <8 x i1> %108 to i8
%114 = call i8 @llvm.ctpop.i8(i8 %113)
%115 = zext i8 %114 to i32
%116 = add nuw nsw i32 %115, %112
%117 = add nuw nsw i32 %116, %104
ret i32 %117
}