#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 */
typedef uintptr_t x7;
typedef uintptr_t x6;
typedef uintptr_t x5;
typedef uintptr_t x4;
typedef uintptr_t x3;
typedef uintptr_t x2;
typedef uintptr_t x1;
typedef uintptr_t x0;
typedef int /*<<< orphan*/ out0;
typedef int /*<<< orphan*/ in2;
typedef int /*<<< orphan*/ in1;

/* Variables and functions */
uintptr_t _br2_load(int /*<<< orphan*/, int);
int /*<<< orphan*/ _br2_store(int /*<<< orphan*/, uintptr_t, int);
void internal_fiat_secp256k1_selectznz(uintptr_t out0, uintptr_t in0,
                                       uintptr_t in1, uintptr_t in2) {
  uintptr_t x4, x8, x0, x9, x5, x11, x1, x12, x6, x14, x2, x15, x7, x17, x3,
      x18, x10, x13, x16, x19, x20, x21, x22, x23;
  x0 = _br2_load((in1) + ((uintptr_t)0ULL), sizeof(uintptr_t));
  x1 = _br2_load((in1) + ((uintptr_t)8ULL), sizeof(uintptr_t));
  x2 = _br2_load((in1) + ((uintptr_t)16ULL), sizeof(uintptr_t));
  x3 = _br2_load((in1) + ((uintptr_t)24ULL), sizeof(uintptr_t));
  x4 = _br2_load((in2) + ((uintptr_t)0ULL), sizeof(uintptr_t));
  x5 = _br2_load((in2) + ((uintptr_t)8ULL), sizeof(uintptr_t));
  x6 = _br2_load((in2) + ((uintptr_t)16ULL), sizeof(uintptr_t));
  x7 = _br2_load((in2) + ((uintptr_t)24ULL), sizeof(uintptr_t));
  x8 = ((uintptr_t)-1ULL) + ((in0) == ((uintptr_t)0ULL));
  x9 = (x8) ^ ((uintptr_t)18446744073709551615ULL);
  x10 = ((x4) & (x8)) | ((x0) & (x9));
  x11 = ((uintptr_t)-1ULL) + ((in0) == ((uintptr_t)0ULL));
  x12 = (x11) ^ ((uintptr_t)18446744073709551615ULL);
  x13 = ((x5) & (x11)) | ((x1) & (x12));
  x14 = ((uintptr_t)-1ULL) + ((in0) == ((uintptr_t)0ULL));
  x15 = (x14) ^ ((uintptr_t)18446744073709551615ULL);
  x16 = ((x6) & (x14)) | ((x2) & (x15));
  x17 = ((uintptr_t)-1ULL) + ((in0) == ((uintptr_t)0ULL));
  x18 = (x17) ^ ((uintptr_t)18446744073709551615ULL);
  x19 = ((x7) & (x17)) | ((x3) & (x18));
  x20 = x10;
  x21 = x13;
  x22 = x16;
  x23 = x19;
  _br2_store((out0) + ((uintptr_t)0ULL), x20, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)8ULL), x21, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)16ULL), x22, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)24ULL), x23, sizeof(uintptr_t));
  return;
}


x86 assembly (clang, -O0):
<internal_fiat_secp256k1_selectznz>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x0,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x98(%rbp)
mov    -0x20(%rbp),%rax
add    $0x0,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
and    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
and    -0x40(%rbp),%rcx
or     %rcx,%rax
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    $0xffffffffffffffff,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x60(%rbp)
mov    -0x48(%rbp),%rax
and    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rcx
and    -0x60(%rbp),%rcx
or     %rcx,%rax
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    $0xffffffffffffffff,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x80(%rbp)
mov    -0x68(%rbp),%rax
and    -0x70(%rbp),%rax
mov    -0x78(%rbp),%rcx
and    -0x80(%rbp),%rcx
or     %rcx,%rax
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    $0xffffffffffffffff,%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x88(%rbp),%rax
and    -0x90(%rbp),%rax
mov    -0x98(%rbp),%rcx
and    -0xa0(%rbp),%rcx
or     %rcx,%rax
mov    %rax,-0xc0(%rbp)
mov    -0xa8(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0xc0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x8(%rbp),%rax
add    $0x0,%rax
mov    %eax,%edi
mov    -0xc8(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    -0xd0(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %eax,%edi
mov    -0xd8(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    -0xe0(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_fiat_secp256k1_selectznz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %rsi,0x20(%rsp)
mov    %rdi,%r12
mov    %ebp,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,0x18(%rsp)
lea    0x8(%rbp),%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,0x10(%rsp)
lea    0x10(%rbp),%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,0x8(%rsp)
add    $0x18,%ebp
mov    %ebp,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,%r14
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,%r13
lea    0x8(%rbx),%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,%rbp
lea    0x10(%rbx),%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,%r15
add    $0x18,%ebx
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
cmpq   $0x0,0x20(%rsp)
cmove  0x18(%rsp),%r13
cmove  0x10(%rsp),%rbp
cmove  0x8(%rsp),%r15
cmovne %rax,%r14
mov    %r12d,%edi
mov    %r13,%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
lea    0x8(%r12),%edi
mov    %rbp,%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
lea    0x10(%r12),%edi
mov    %r15,%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
add    $0x18,%r12d
mov    %r12d,%edi
mov    %r14,%rsi
mov    $0x8,%edx
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <_br2_store@plt>

LLVM IR (-O0):
define void @internal_fiat_secp256k1_selectznz(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
%25 = alloca i64
%26 = alloca i64
%27 = alloca i64
%28 = alloca i64
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%33 = load i64, i64* %7
%34 = add i64 %33, 0
%35 = trunc i64 %34 to i32
%36 = call i64 @_br2_load(i32 %35, i32 8)
store i64 %36, i64* %11
%37 = load i64, i64* %7
%38 = add i64 %37, 8
%39 = trunc i64 %38 to i32
%40 = call i64 @_br2_load(i32 %39, i32 8)
store i64 %40, i64* %15
%41 = load i64, i64* %7
%42 = add i64 %41, 16
%43 = trunc i64 %42 to i32
%44 = call i64 @_br2_load(i32 %43, i32 8)
store i64 %44, i64* %19
%45 = load i64, i64* %7
%46 = add i64 %45, 24
%47 = trunc i64 %46 to i32
%48 = call i64 @_br2_load(i32 %47, i32 8)
store i64 %48, i64* %23
%49 = load i64, i64* %8
%50 = add i64 %49, 0
%51 = trunc i64 %50 to i32
%52 = call i64 @_br2_load(i32 %51, i32 8)
store i64 %52, i64* %9
%53 = load i64, i64* %8
%54 = add i64 %53, 8
%55 = trunc i64 %54 to i32
%56 = call i64 @_br2_load(i32 %55, i32 8)
store i64 %56, i64* %13
%57 = load i64, i64* %8
%58 = add i64 %57, 16
%59 = trunc i64 %58 to i32
%60 = call i64 @_br2_load(i32 %59, i32 8)
store i64 %60, i64* %17
%61 = load i64, i64* %8
%62 = add i64 %61, 24
%63 = trunc i64 %62 to i32
%64 = call i64 @_br2_load(i32 %63, i32 8)
store i64 %64, i64* %21
%65 = load i64, i64* %6
%66 = icmp eq i64 %65, 0
%67 = zext i1 %66 to i32
%68 = sext i32 %67 to i64
%69 = add i64 -1, %68
store i64 %69, i64* %10
%70 = load i64, i64* %10
%71 = xor i64 %70, -1
store i64 %71, i64* %12
%72 = load i64, i64* %9
%73 = load i64, i64* %10
%74 = and i64 %72, %73
%75 = load i64, i64* %11
%76 = load i64, i64* %12
%77 = and i64 %75, %76
%78 = or i64 %74, %77
store i64 %78, i64* %25
%79 = load i64, i64* %6
%80 = icmp eq i64 %79, 0
%81 = zext i1 %80 to i32
%82 = sext i32 %81 to i64
%83 = add i64 -1, %82
store i64 %83, i64* %14
%84 = load i64, i64* %14
%85 = xor i64 %84, -1
store i64 %85, i64* %16
%86 = load i64, i64* %13
%87 = load i64, i64* %14
%88 = and i64 %86, %87
%89 = load i64, i64* %15
%90 = load i64, i64* %16
%91 = and i64 %89, %90
%92 = or i64 %88, %91
store i64 %92, i64* %26
%93 = load i64, i64* %6
%94 = icmp eq i64 %93, 0
%95 = zext i1 %94 to i32
%96 = sext i32 %95 to i64
%97 = add i64 -1, %96
store i64 %97, i64* %18
%98 = load i64, i64* %18
%99 = xor i64 %98, -1
store i64 %99, i64* %20
%100 = load i64, i64* %17
%101 = load i64, i64* %18
%102 = and i64 %100, %101
%103 = load i64, i64* %19
%104 = load i64, i64* %20
%105 = and i64 %103, %104
%106 = or i64 %102, %105
store i64 %106, i64* %27
%107 = load i64, i64* %6
%108 = icmp eq i64 %107, 0
%109 = zext i1 %108 to i32
%110 = sext i32 %109 to i64
%111 = add i64 -1, %110
store i64 %111, i64* %22
%112 = load i64, i64* %22
%113 = xor i64 %112, -1
store i64 %113, i64* %24
%114 = load i64, i64* %21
%115 = load i64, i64* %22
%116 = and i64 %114, %115
%117 = load i64, i64* %23
%118 = load i64, i64* %24
%119 = and i64 %117, %118
%120 = or i64 %116, %119
store i64 %120, i64* %28
%121 = load i64, i64* %25
store i64 %121, i64* %29
%122 = load i64, i64* %26
store i64 %122, i64* %30
%123 = load i64, i64* %27
store i64 %123, i64* %31
%124 = load i64, i64* %28
store i64 %124, i64* %32
%125 = load i64, i64* %5
%126 = add i64 %125, 0
%127 = trunc i64 %126 to i32
%128 = load i64, i64* %29
%129 = call i32 @_br2_store(i32 %127, i64 %128, i32 8)
%130 = load i64, i64* %5
%131 = add i64 %130, 8
%132 = trunc i64 %131 to i32
%133 = load i64, i64* %30
%134 = call i32 @_br2_store(i32 %132, i64 %133, i32 8)
%135 = load i64, i64* %5
%136 = add i64 %135, 16
%137 = trunc i64 %136 to i32
%138 = load i64, i64* %31
%139 = call i32 @_br2_store(i32 %137, i64 %138, i32 8)
%140 = load i64, i64* %5
%141 = add i64 %140, 24
%142 = trunc i64 %141 to i32
%143 = load i64, i64* %32
%144 = call i32 @_br2_store(i32 %142, i64 %143, i32 8)
ret void
}

LLVM IR (-O2):
define void @internal_fiat_secp256k1_selectznz(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = trunc i64 %2 to i32
%6 = tail call i64 @_br2_load(i32 %5, i32 8)
%7 = add i32 %5, 8
%8 = tail call i64 @_br2_load(i32 %7, i32 8)
%9 = add i32 %5, 16
%10 = tail call i64 @_br2_load(i32 %9, i32 8)
%11 = add i32 %5, 24
%12 = tail call i64 @_br2_load(i32 %11, i32 8)
%13 = trunc i64 %3 to i32
%14 = tail call i64 @_br2_load(i32 %13, i32 8)
%15 = add i32 %13, 8
%16 = tail call i64 @_br2_load(i32 %15, i32 8)
%17 = add i32 %13, 16
%18 = tail call i64 @_br2_load(i32 %17, i32 8)
%19 = add i32 %13, 24
%20 = tail call i64 @_br2_load(i32 %19, i32 8)
%21 = icmp eq i64 %1, 0
%22 = select i1 %21, i64 %6, i64 %14
%23 = select i1 %21, i64 %8, i64 %16
%24 = select i1 %21, i64 %10, i64 %18
%25 = select i1 %21, i64 %12, i64 %20
%26 = trunc i64 %0 to i32
%27 = tail call i32 @_br2_store(i32 %26, i64 %22, i32 8)
%28 = add i32 %26, 8
%29 = tail call i32 @_br2_store(i32 %28, i64 %23, i32 8)
%30 = add i32 %26, 16
%31 = tail call i32 @_br2_store(i32 %30, i64 %24, i32 8)
%32 = add i32 %26, 24
%33 = tail call i32 @_br2_store(i32 %32, i64 %25, i32 8)
ret void
}