#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_pextd(unsigned long long, unsigned long long);
int main(int argc, char *argv[]) {
  unsigned long long int sources[4], masks[4];
  unsigned long long int results[4][4] = {
      {0x0000a5f0ll, 0x00007e3cll, 0x000050ecll, 0x0000af73ll},
      {0x00007e3cll, 0x0000a5f0ll, 0x0000ec50ll, 0x000073afll},
      {0x00003ca5ll, 0x0000f07ell, 0x0000c50ell, 0x00003af7ll},
      {0x00005a0fll, 0x0000e7c3ll, 0x0000af73ll, 0x000050ecll},
  };
  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_pextd(sources[i], masks[j]) != results[i][j])
        abort();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%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>
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,-0xdc(%rbp)
cmpl   $0x4,-0xdc(%rbp)
jge    124e <main+0x11e>
movl   $0x0,-0xe0(%rbp)
cmpl   $0x4,-0xe0(%rbp)
jge    1235 <main+0x105>
movslq -0xdc(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
movslq -0xe0(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   1040 <do_pextd@plt>
movslq -0xdc(%rbp),%rdx
lea    -0xd0(%rbp),%rcx
shl    $0x5,%rdx
add    %rdx,%rcx
movslq -0xe0(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     121c <main+0xec>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1221 <main+0xf1>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    11c5 <main+0x95>
jmp    123a <main+0x10a>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    11ae <main+0x7e>
xor    %eax,%eax
add    $0xe0,%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_pextd@plt>
cmp    $0xa5f0,%rax
jne    12ca <main+0x1aa>
mov    $0xa5f07e3c,%edi
mov    $0xffff,%esi
call   1040 <do_pextd@plt>
cmp    $0x7e3c,%rax
jne    12ca <main+0x1aa>
mov    $0xa5f07e3c,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_pextd@plt>
cmp    $0x50ec,%rax
jne    12ca <main+0x1aa>
add    $0x4b0072b4,%r14
mov    $0xa5f07e3c,%edi
mov    %r14,%rsi
call   1040 <do_pextd@plt>
cmp    $0xaf73,%rax
jne    12ca <main+0x1aa>
mov    $0x7e3ca5f0,%edi
mov    %rbx,%rsi
call   1040 <do_pextd@plt>
cmp    $0x7e3c,%rax
jne    12ca <main+0x1aa>
mov    $0x7e3ca5f0,%edi
mov    $0xffff,%esi
call   1040 <do_pextd@plt>
cmp    $0xa5f0,%rax
jne    12ca <main+0x1aa>
mov    $0x7e3ca5f0,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_pextd@plt>
cmp    $0xec50,%rax
jne    12ca <main+0x1aa>
mov    $0x7e3ca5f0,%edi
mov    %r14,%rsi
call   1040 <do_pextd@plt>
cmp    $0x73af,%rax
jne    12ca <main+0x1aa>
mov    $0x3ca5f07e,%edi
mov    %rbx,%rsi
call   1040 <do_pextd@plt>
cmp    $0x3ca5,%rax
jne    12ca <main+0x1aa>
mov    $0x3ca5f07e,%edi
mov    $0xffff,%esi
call   1040 <do_pextd@plt>
cmp    $0xf07e,%rax
jne    12ca <main+0x1aa>
mov    $0x3ca5f07e,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_pextd@plt>
cmp    $0xc50e,%rax
jne    12ca <main+0x1aa>
mov    $0x3ca5f07e,%edi
mov    %r14,%rsi
call   1040 <do_pextd@plt>
cmp    $0x3af7,%rax
jne    12ca <main+0x1aa>
mov    $0x5a0fe7c3,%edi
mov    %rbx,%rsi
call   1040 <do_pextd@plt>
cmp    $0x5a0f,%rax
jne    12ca <main+0x1aa>
mov    $0x5a0fe7c3,%edi
mov    $0xffff,%esi
call   1040 <do_pextd@plt>
cmp    $0xe7c3,%rax
jne    12ca <main+0x1aa>
mov    $0x5a0fe7c3,%edi
mov    $0xf0f0f0f,%esi
call   1040 <do_pextd@plt>
cmp    $0xaf73,%rax
jne    12ca <main+0x1aa>
mov    $0x5a0fe7c3,%edi
mov    %r14,%rsi
call   1040 <do_pextd@plt>
cmp    $0x50ec,%rax
jne    12ca <main+0x1aa>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const.main.results = [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]]
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 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 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 0
store i64 2784001596, i64* %13
%14 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 1
store i64 2117903856, i64* %14
%15 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 2
store i64 1017507966, i64* %15
%16 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 3
store i64 1510991811, i64* %16
%17 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 0
store i64 4294901760, i64* %17
%18 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 1
store i64 65535, i64* %18
%19 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 2
store i64 252645135, i64* %19
%20 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 3
store i64 4042322160, i64* %20
store i32 0, i32* %10
br label %21
21: ; preds = %53, %2
%22 = load i32, i32* %10
%23 = icmp slt i32 %22, 4
br i1 %23, label %24, label %56
24: ; preds = %21
store i32 0, i32* %11
br label %25
25: ; preds = %49, %24
%26 = load i32, i32* %11
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %52
28: ; preds = %25
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [4 x i64], [4 x i64]* %6, i64 0, i64 %30
%32 = load i64, i64* %31
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4 x i64], [4 x i64]* %7, i64 0, i64 %34
%36 = load i64, i64* %35
%37 = call i64 @do_pextd(i64 %32, i64 %36)
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [4 x [4 x i64]], [4 x [4 x i64]]* %8, i64 0, i64 %39
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4 x i64], [4 x i64]* %40, i64 0, i64 %42
%44 = load i64, i64* %43
%45 = icmp ne i64 %37, %44
br i1 %45, label %46, label %48
46: ; preds = %28
%47 = call i32 (...) @abort()
unreachable
48: ; preds = %28
br label %49
49: ; preds = %48
%50 = load i32, i32* %11
%51 = add nsw i32 %50, 1
store i32 %51, i32* %11
br label %25
52: ; preds = %25
br label %53
53: ; preds = %52
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
store i32 %55, i32* %10
br label %21
56: ; preds = %21
ret i32 0
}

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