#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*/ abort();
unsigned long long do_cnttzdm(unsigned long long, unsigned long long);
int main(int argc, char *argv[]) {
  unsigned long long int sources[4], masks[4];
  unsigned long long int intermediates[4][4] = {
      {0x0000a5f0ll, 0x00007e3cll, 0x000050ecll, 0x0000af73ll},
      {0x00007e3cll, 0x0000a5f0ll, 0x0000ec50ll, 0x000073afll},
      {0x00003ca5ll, 0x0000f07ell, 0x0000c50ell, 0x00003af7ll},
      {0x00005a0fll, 0x0000e7c3ll, 0x0000af73ll, 0x000050ecll},
  };
  unsigned long long int results[4][4] = {
      {4, 2, 2, 0},
      {2, 4, 4, 0},
      {0, 1, 1, 0},
      {0, 0, 0, 2},
  };
  sources[0] = 0xa5f07e3cll;
  sources[1] = 0x7e3ca5f0ll;
  sources[2] = 0x3ca5f07ell;
  sources[3] = 0x5a0fe7c3ll;
  masks[0] = 0xffff0000ll;
  masks[1] = 0x0000ffffll;
  masks[2] = 0x0f0f0f0fll;
  masks[3] = 0xf0f0f0f0ll;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (do_cnttzdm(sources[i], masks[j]) != results[i][j])
        abort();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
lea    -0x150(%rbp),%rdi
lea    0xf11(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
mov    $0xa5f07e3c,%eax
mov    %rax,-0x30(%rbp)
movq   $0x7e3ca5f0,-0x28(%rbp)
7e
movq   $0x3ca5f07e,-0x20(%rbp)
3c
movq   $0x5a0fe7c3,-0x18(%rbp)
5a
mov    $0xffff0000,%eax
mov    %rax,-0x50(%rbp)
movq   $0xffff,-0x48(%rbp)
movq   $0xf0f0f0f,-0x40(%rbp)
0f
mov    $0xf0f0f0f0,%eax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x154(%rbp)
cmpl   $0x4,-0x154(%rbp)
jge    1266 <main+0x136>
movl   $0x0,-0x158(%rbp)
cmpl   $0x4,-0x158(%rbp)
jge    124d <main+0x11d>
movslq -0x154(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
movslq -0x158(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   1040 <do_cnttzdm@plt>
movslq -0x154(%rbp),%rdx
lea    -0x150(%rbp),%rcx
shl    $0x5,%rdx
add    %rdx,%rcx
movslq -0x158(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     1234 <main+0x104>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1239 <main+0x109>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    11dd <main+0xad>
jmp    1252 <main+0x122>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    11c6 <main+0x96>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xa5f07e3c,%r14d
lea    0x5a0e81c4(%r14),%rbx
mov    $0xa5f07e3c,%edi
mov    %rbx,%rsi
call   1040 <do_cnttzdm@plt>
cmp    $0x4,%rax
jne    129f <main+0x17f>
mov    $0xa5f07e3c,%edi
mov    $0xffff,%esi
call   1040 <do_cnttzdm@plt>
cmp    $0x2,%rax
jne    129f <main+0x17f>
mov    $0xa5f07e3c,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cnttzdm@plt>
cmp    $0x2,%rax
jne    129f <main+0x17f>
add    $0x4b0072b4,%r14
mov    $0xa5f07e3c,%edi
mov    %r14,%rsi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x7e3ca5f0,%edi
mov    %rbx,%rsi
call   1040 <do_cnttzdm@plt>
cmp    $0x2,%rax
jne    129f <main+0x17f>
mov    $0x7e3ca5f0,%edi
mov    $0xffff,%esi
call   1040 <do_cnttzdm@plt>
cmp    $0x4,%rax
jne    129f <main+0x17f>
mov    $0x7e3ca5f0,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cnttzdm@plt>
cmp    $0x4,%rax
jne    129f <main+0x17f>
mov    $0x7e3ca5f0,%edi
mov    %r14,%rsi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x3ca5f07e,%edi
mov    %rbx,%rsi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x3ca5f07e,%edi
mov    $0xffff,%esi
call   1040 <do_cnttzdm@plt>
cmp    $0x1,%rax
jne    129f <main+0x17f>
mov    $0x3ca5f07e,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cnttzdm@plt>
cmp    $0x1,%rax
jne    129f <main+0x17f>
mov    $0x3ca5f07e,%edi
mov    %r14,%rsi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x5a0fe7c3,%edi
mov    %rbx,%rsi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x5a0fe7c3,%edi
mov    $0xffff,%esi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x5a0fe7c3,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cnttzdm@plt>
test   %rax,%rax
jne    129f <main+0x17f>
mov    $0x5a0fe7c3,%edi
mov    %r14,%rsi
call   1040 <do_cnttzdm@plt>
cmp    $0x2,%rax
jne    129f <main+0x17f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const.main.intermediates = [4 x [4 x i64]] [[4 x i64] [i64 42480, i64 32316, i64 20716, i64 44915], [4 x i64] [i64 32316, i64 42480, i64 60496, i64 29615], [4 x i64] [i64 15525, i64 61566, i64 50446, i64 15095], [4 x i64] [i64 23055, i64 59331, i64 44915, i64 20716]]
@__const.main.results = [4 x [4 x i64]] [[4 x i64] [i64 4, i64 2, i64 2, i64 0], [4 x i64] [i64 2, i64 4, i64 4, i64 0], [4 x i64] [i64 0, i64 1, i64 1, i64 0], [4 x i64] [i64 0, i64 0, i64 0, i64 2]]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i64]
%7 = alloca [4 x i64]
%8 = alloca [4 x [4 x i64]]
%9 = alloca [4 x [4 x i64]]
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [4 x [4 x i64]]* %8 to i8*
%13 = bitcast [4 x [4 x i64]]* %9 to i8*
%14 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 0
store i64 2784001596, i64* %14
%15 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 1
store i64 2117903856, i64* %15
%16 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 2
store i64 1017507966, i64* %16
%17 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 3
store i64 1510991811, i64* %17
%18 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 0
store i64 4294901760, i64* %18
%19 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 1
store i64 65535, i64* %19
%20 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 2
store i64 252645135, i64* %20
%21 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 3
store i64 4042322160, i64* %21
store i32 0, i32* %10
br label %22
22: ; preds = %54, %2
%23 = load i32, i32* %10
%24 = icmp slt i32 %23, 4
br i1 %24, label %25, label %57
25: ; preds = %22
store i32 0, i32* %11
br label %26
26: ; preds = %50, %25
%27 = load i32, i32* %11
%28 = icmp slt i32 %27, 4
br i1 %28, label %29, label %53
29: ; preds = %26
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 %31
%33 = load i64, i64* %32
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 %35
%37 = load i64, i64* %36
%38 = call i64 @do_cnttzdm(i64 %33, i64 %37)
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x [4 x i64]], [4 x [4 x i64]]* %9, i64 0, i64 %40
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4 x i64], [4 x i64]* %41, i64 0, i64 %43
%45 = load i64, i64* %44
%46 = icmp ne i64 %38, %45
br i1 %46, label %47, label %49
47: ; preds = %29
%48 = call i32 (...) @abort()
unreachable
49: ; preds = %29
br label %50
50: ; preds = %49
%51 = load i32, i32* %11
%52 = add nsw i32 %51, 1
store i32 %52, i32* %11
br label %26
53: ; preds = %26
br label %54
54: ; preds = %53
%55 = load i32, i32* %10
%56 = add nsw i32 %55, 1
store i32 %56, i32* %10
br label %22
57: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @do_cnttzdm(i64 2784001596, i64 4294901760)
%4 = icmp eq i64 %3, 4
br i1 %4, label %5, label %51
5: ; preds = %2
%6 = tail call i64 @do_cnttzdm(i64 2784001596, i64 65535)
%7 = icmp eq i64 %6, 2
br i1 %7, label %8, label %51
8: ; preds = %5
%9 = tail call i64 @do_cnttzdm(i64 2784001596, i64 252645135)
%10 = icmp eq i64 %9, 2
br i1 %10, label %11, label %51
11: ; preds = %8
%12 = tail call i64 @do_cnttzdm(i64 2784001596, i64 4042322160)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %51
14: ; preds = %11
%15 = tail call i64 @do_cnttzdm(i64 2117903856, i64 4294901760)
%16 = icmp eq i64 %15, 2
br i1 %16, label %17, label %51
17: ; preds = %14
%18 = tail call i64 @do_cnttzdm(i64 2117903856, i64 65535)
%19 = icmp eq i64 %18, 4
br i1 %19, label %20, label %51
20: ; preds = %17
%21 = tail call i64 @do_cnttzdm(i64 2117903856, i64 252645135)
%22 = icmp eq i64 %21, 4
br i1 %22, label %23, label %51
23: ; preds = %20
%24 = tail call i64 @do_cnttzdm(i64 2117903856, i64 4042322160)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %51
26: ; preds = %23
%27 = tail call i64 @do_cnttzdm(i64 1017507966, i64 4294901760)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %51
29: ; preds = %26
%30 = tail call i64 @do_cnttzdm(i64 1017507966, i64 65535)
%31 = icmp eq i64 %30, 1
br i1 %31, label %32, label %51
32: ; preds = %29
%33 = tail call i64 @do_cnttzdm(i64 1017507966, i64 252645135)
%34 = icmp eq i64 %33, 1
br i1 %34, label %35, label %51
35: ; preds = %32
%36 = tail call i64 @do_cnttzdm(i64 1017507966, i64 4042322160)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %51
38: ; preds = %35
%39 = tail call i64 @do_cnttzdm(i64 1510991811, i64 4294901760)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = tail call i64 @do_cnttzdm(i64 1510991811, i64 65535)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %51
44: ; preds = %41
%45 = tail call i64 @do_cnttzdm(i64 1510991811, i64 252645135)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = tail call i64 @do_cnttzdm(i64 1510991811, i64 4042322160)
%49 = icmp eq i64 %48, 2
br i1 %49, label %50, label %51
50: ; preds = %47
ret i32 0
51: ; preds = %47, %44, %41, %38, %35, %32, %29, %26, %23, %20, %17, %14, %11, %8, %5, %2
%52 = tail call i32 (...) @abort()
unreachable
}