#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_cntlzdm(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] = {
      {0, 1, 1, 0},
      {1, 0, 0, 1},
      {2, 0, 0, 2},
      {1, 0, 0, 1},
  };
  sources[0] = 0xa5f07e3cll;
  sources[1] = 0x7e3ca5f0ll;
  sources[2] = 0x3ca5f07ell;
  sources[3] = 0x5a0fe7c3ll;
  masks[0] = 0xffff0000ll;
  masks[1] = 0x0000ffffll;
  masks[2] = 0x0f0f0f0fll;
  masks[3] = 0xf0f0f0f0ll;
  unsigned long long int result;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (do_cntlzdm(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,-0x15c(%rbp)
cmpl   $0x4,-0x15c(%rbp)
jge    1266 <main+0x136>
movl   $0x0,-0x160(%rbp)
cmpl   $0x4,-0x160(%rbp)
jge    124d <main+0x11d>
movslq -0x15c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
movslq -0x160(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   1040 <do_cntlzdm@plt>
movslq -0x15c(%rbp),%rdx
lea    -0x150(%rbp),%rcx
shl    $0x5,%rdx
add    %rdx,%rcx
movslq -0x160(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     1234 <main+0x104>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1239 <main+0x109>
mov    -0x160(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x160(%rbp)
jmp    11dd <main+0xad>
jmp    1252 <main+0x122>
mov    -0x15c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x15c(%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_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0xa5f07e3c,%edi
mov    $0xffff,%esi
call   1040 <do_cntlzdm@plt>
cmp    $0x1,%rax
jne    129e <main+0x17e>
mov    $0xa5f07e3c,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cntlzdm@plt>
cmp    $0x1,%rax
jne    129e <main+0x17e>
add    $0x4b0072b4,%r14
mov    $0xa5f07e3c,%edi
mov    %r14,%rsi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x7e3ca5f0,%edi
mov    %rbx,%rsi
call   1040 <do_cntlzdm@plt>
cmp    $0x1,%rax
jne    129e <main+0x17e>
mov    $0x7e3ca5f0,%edi
mov    $0xffff,%esi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x7e3ca5f0,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x7e3ca5f0,%edi
mov    %r14,%rsi
call   1040 <do_cntlzdm@plt>
cmp    $0x1,%rax
jne    129e <main+0x17e>
mov    $0x3ca5f07e,%edi
mov    %rbx,%rsi
call   1040 <do_cntlzdm@plt>
cmp    $0x2,%rax
jne    129e <main+0x17e>
mov    $0x3ca5f07e,%edi
mov    $0xffff,%esi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x3ca5f07e,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x3ca5f07e,%edi
mov    %r14,%rsi
call   1040 <do_cntlzdm@plt>
cmp    $0x2,%rax
jne    129e <main+0x17e>
mov    $0x5a0fe7c3,%edi
mov    %rbx,%rsi
call   1040 <do_cntlzdm@plt>
cmp    $0x1,%rax
jne    129e <main+0x17e>
mov    $0x5a0fe7c3,%edi
mov    $0xffff,%esi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x5a0fe7c3,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_cntlzdm@plt>
test   %rax,%rax
jne    129e <main+0x17e>
mov    $0x5a0fe7c3,%edi
mov    %r14,%rsi
call   1040 <do_cntlzdm@plt>
cmp    $0x1,%rax
jne    129e <main+0x17e>
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 0, i64 1, i64 1, i64 0], [4 x i64] [i64 1, i64 0, i64 0, i64 1], [4 x i64] [i64 2, i64 0, i64 0, i64 2], [4 x i64] [i64 1, i64 0, i64 0, i64 1]]
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 i64
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [4 x [4 x i64]]* %8 to i8*
%14 = bitcast [4 x [4 x i64]]* %9 to i8*
%15 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 0
store i64 2784001596, i64* %15
%16 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 1
store i64 2117903856, i64* %16
%17 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 2
store i64 1017507966, i64* %17
%18 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 3
store i64 1510991811, i64* %18
%19 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 0
store i64 4294901760, i64* %19
%20 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 1
store i64 65535, i64* %20
%21 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 2
store i64 252645135, i64* %21
%22 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 3
store i64 4042322160, i64* %22
store i32 0, i32* %11
br label %23
23: ; preds = %55, %2
%24 = load i32, i32* %11
%25 = icmp slt i32 %24, 4
br i1 %25, label %26, label %58
26: ; preds = %23
store i32 0, i32* %12
br label %27
27: ; preds = %51, %26
%28 = load i32, i32* %12
%29 = icmp slt i32 %28, 4
br i1 %29, label %30, label %54
30: ; preds = %27
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 %32
%34 = load i64, i64* %33
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 %36
%38 = load i64, i64* %37
%39 = call i64 @do_cntlzdm(i64 %34, i64 %38)
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4 x [4 x i64]], [4 x [4 x i64]]* %9, i64 0, i64 %41
%43 = load i32, i32* %12
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [4 x i64], [4 x i64]* %42, i64 0, i64 %44
%46 = load i64, i64* %45
%47 = icmp ne i64 %39, %46
br i1 %47, label %48, label %50
48: ; preds = %30
%49 = call i32 (...) @abort()
unreachable
50: ; preds = %30
br label %51
51: ; preds = %50
%52 = load i32, i32* %12
%53 = add nsw i32 %52, 1
store i32 %53, i32* %12
br label %27
54: ; preds = %27
br label %55
55: ; preds = %54
%56 = load i32, i32* %11
%57 = add nsw i32 %56, 1
store i32 %57, i32* %11
br label %23
58: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @do_cntlzdm(i64 2784001596, i64 4294901760)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %51
5: ; preds = %2
%6 = tail call i64 @do_cntlzdm(i64 2784001596, i64 65535)
%7 = icmp eq i64 %6, 1
br i1 %7, label %8, label %51
8: ; preds = %5
%9 = tail call i64 @do_cntlzdm(i64 2784001596, i64 252645135)
%10 = icmp eq i64 %9, 1
br i1 %10, label %11, label %51
11: ; preds = %8
%12 = tail call i64 @do_cntlzdm(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_cntlzdm(i64 2117903856, i64 4294901760)
%16 = icmp eq i64 %15, 1
br i1 %16, label %17, label %51
17: ; preds = %14
%18 = tail call i64 @do_cntlzdm(i64 2117903856, i64 65535)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %51
20: ; preds = %17
%21 = tail call i64 @do_cntlzdm(i64 2117903856, i64 252645135)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %51
23: ; preds = %20
%24 = tail call i64 @do_cntlzdm(i64 2117903856, i64 4042322160)
%25 = icmp eq i64 %24, 1
br i1 %25, label %26, label %51
26: ; preds = %23
%27 = tail call i64 @do_cntlzdm(i64 1017507966, i64 4294901760)
%28 = icmp eq i64 %27, 2
br i1 %28, label %29, label %51
29: ; preds = %26
%30 = tail call i64 @do_cntlzdm(i64 1017507966, i64 65535)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %51
32: ; preds = %29
%33 = tail call i64 @do_cntlzdm(i64 1017507966, i64 252645135)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %51
35: ; preds = %32
%36 = tail call i64 @do_cntlzdm(i64 1017507966, i64 4042322160)
%37 = icmp eq i64 %36, 2
br i1 %37, label %38, label %51
38: ; preds = %35
%39 = tail call i64 @do_cntlzdm(i64 1510991811, i64 4294901760)
%40 = icmp eq i64 %39, 1
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = tail call i64 @do_cntlzdm(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_cntlzdm(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_cntlzdm(i64 1510991811, i64 4042322160)
%49 = icmp eq i64 %48, 1
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
}