#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 x9;
typedef uintptr_t x8;
typedef uintptr_t x7;
typedef uintptr_t x6;
typedef uintptr_t x5;
typedef uintptr_t x11;
typedef uintptr_t x10;
typedef int /*<<< orphan*/ out0;
typedef int /*<<< orphan*/ in0;

/* Variables and functions */
uintptr_t _br2_load(int /*<<< orphan*/, int);
int /*<<< orphan*/ _br2_store(int /*<<< orphan*/, uintptr_t, int);
void internal_fiat_25519_carry(uintptr_t out0, uintptr_t in0) {
  uintptr_t x0, x1, x2, x3, x4, x5, x6, x10, x11, x7, x8, x9, x12, x13, x14,
      x15, x16, x17, x18, x19, x20, x21;
  x0 = _br2_load((in0) + ((uintptr_t)0ULL), sizeof(uintptr_t));
  x1 = _br2_load((in0) + ((uintptr_t)8ULL), sizeof(uintptr_t));
  x2 = _br2_load((in0) + ((uintptr_t)16ULL), sizeof(uintptr_t));
  x3 = _br2_load((in0) + ((uintptr_t)24ULL), sizeof(uintptr_t));
  x4 = _br2_load((in0) + ((uintptr_t)32ULL), sizeof(uintptr_t));
  x5 = x0;
  x6 = ((x5) >> ((uintptr_t)51ULL)) + (x1);
  x7 = ((x6) >> ((uintptr_t)51ULL)) + (x2);
  x8 = ((x7) >> ((uintptr_t)51ULL)) + (x3);
  x9 = ((x8) >> ((uintptr_t)51ULL)) + (x4);
  x10 = ((x5) & ((uintptr_t)2251799813685247ULL)) +
        (((x9) >> ((uintptr_t)51ULL)) * ((uintptr_t)19ULL));
  x11 =
      ((x10) >> ((uintptr_t)51ULL)) + ((x6) & ((uintptr_t)2251799813685247ULL));
  x12 = (x10) & ((uintptr_t)2251799813685247ULL);
  x13 = (x11) & ((uintptr_t)2251799813685247ULL);
  x14 =
      ((x11) >> ((uintptr_t)51ULL)) + ((x7) & ((uintptr_t)2251799813685247ULL));
  x15 = (x8) & ((uintptr_t)2251799813685247ULL);
  x16 = (x9) & ((uintptr_t)2251799813685247ULL);
  x17 = x12;
  x18 = x13;
  x19 = x14;
  x20 = x15;
  x21 = x16;
  _br2_store((out0) + ((uintptr_t)0ULL), x17, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)8ULL), x18, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)16ULL), x19, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)24ULL), x20, sizeof(uintptr_t));
  _br2_store((out0) + ((uintptr_t)32ULL), x21, sizeof(uintptr_t));
  return;
}


x86 assembly (clang, -O0):
<internal_fiat_25519_carry>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x0,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %eax,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
shr    $0x33,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
shr    $0x33,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
shr    $0x33,%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
shr    $0x33,%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x70(%rbp)
movabs $0x7ffffffffffff,%rax
and    -0x40(%rbp),%rax
mov    -0x70(%rbp),%rcx
shr    $0x33,%rcx
imul   $0x13,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
shr    $0x33,%rax
movabs $0x7ffffffffffff,%rcx
and    -0x48(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
movabs $0x7ffffffffffff,%rax
and    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
movabs $0x7ffffffffffff,%rax
and    -0x58(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x58(%rbp),%rax
shr    $0x33,%rax
movabs $0x7ffffffffffff,%rcx
and    -0x60(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x88(%rbp)
movabs $0x7ffffffffffff,%rax
and    -0x68(%rbp),%rax
mov    %rax,-0x90(%rbp)
movabs $0x7ffffffffffff,%rax
and    -0x70(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x90(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x98(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x8(%rbp),%rax
add    $0x0,%rax
mov    %eax,%edi
mov    -0xa0(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    -0xa8(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %eax,%edi
mov    -0xb0(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    -0xb8(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %eax,%edi
mov    -0xc0(%rbp),%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_fiat_25519_carry>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%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,%r15
lea    0x10(%rbx),%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,%r12
lea    0x18(%rbx),%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %rax,%rbp
add    $0x20,%ebx
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <_br2_load@plt>
mov    %r13,%rcx
shr    $0x33,%rcx
add    %r15,%rcx
mov    %rcx,%rbx
shr    $0x33,%rbx
add    %r12,%rbx
mov    %rbx,%r12
shr    $0x33,%r12
add    %rbp,%r12
mov    %r12,%r15
shr    $0x33,%r15
add    %rax,%r15
movabs $0x7ffffffffffff,%rax
and    %rax,%r13
mov    %r15,%rdx
shr    $0x33,%rdx
lea    (%rdx,%rdx,8),%rsi
lea    (%rdx,%rsi,2),%rsi
add    %r13,%rsi
mov    %rsi,%rdx
shr    $0x33,%rdx
and    %rax,%rcx
add    %rdx,%rcx
and    %rax,%rsi
mov    %rcx,%rbp
and    %rax,%rbp
shr    $0x33,%rcx
and    %rax,%rbx
add    %rcx,%rbx
and    %rax,%r12
and    %rax,%r15
mov    %r14d,%edi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
lea    0x8(%r14),%edi
mov    %rbp,%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
lea    0x10(%r14),%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
lea    0x18(%r14),%edi
mov    %r12,%rsi
mov    $0x8,%edx
call   1040 <_br2_store@plt>
add    $0x20,%r14d
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x8,%edx
add    $0x8,%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_25519_carry(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%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
store i64 %0, i64* %3
store i64 %1, i64* %4
%27 = load i64, i64* %4
%28 = add i64 %27, 0
%29 = trunc i64 %28 to i32
%30 = call i64 @_br2_load(i32 %29, i32 8)
store i64 %30, i64* %5
%31 = load i64, i64* %4
%32 = add i64 %31, 8
%33 = trunc i64 %32 to i32
%34 = call i64 @_br2_load(i32 %33, i32 8)
store i64 %34, i64* %6
%35 = load i64, i64* %4
%36 = add i64 %35, 16
%37 = trunc i64 %36 to i32
%38 = call i64 @_br2_load(i32 %37, i32 8)
store i64 %38, i64* %7
%39 = load i64, i64* %4
%40 = add i64 %39, 24
%41 = trunc i64 %40 to i32
%42 = call i64 @_br2_load(i32 %41, i32 8)
store i64 %42, i64* %8
%43 = load i64, i64* %4
%44 = add i64 %43, 32
%45 = trunc i64 %44 to i32
%46 = call i64 @_br2_load(i32 %45, i32 8)
store i64 %46, i64* %9
%47 = load i64, i64* %5
store i64 %47, i64* %10
%48 = load i64, i64* %10
%49 = lshr i64 %48, 51
%50 = load i64, i64* %6
%51 = add i64 %49, %50
store i64 %51, i64* %11
%52 = load i64, i64* %11
%53 = lshr i64 %52, 51
%54 = load i64, i64* %7
%55 = add i64 %53, %54
store i64 %55, i64* %14
%56 = load i64, i64* %14
%57 = lshr i64 %56, 51
%58 = load i64, i64* %8
%59 = add i64 %57, %58
store i64 %59, i64* %15
%60 = load i64, i64* %15
%61 = lshr i64 %60, 51
%62 = load i64, i64* %9
%63 = add i64 %61, %62
store i64 %63, i64* %16
%64 = load i64, i64* %10
%65 = and i64 %64, 2251799813685247
%66 = load i64, i64* %16
%67 = lshr i64 %66, 51
%68 = mul i64 %67, 19
%69 = add i64 %65, %68
store i64 %69, i64* %12
%70 = load i64, i64* %12
%71 = lshr i64 %70, 51
%72 = load i64, i64* %11
%73 = and i64 %72, 2251799813685247
%74 = add i64 %71, %73
store i64 %74, i64* %13
%75 = load i64, i64* %12
%76 = and i64 %75, 2251799813685247
store i64 %76, i64* %17
%77 = load i64, i64* %13
%78 = and i64 %77, 2251799813685247
store i64 %78, i64* %18
%79 = load i64, i64* %13
%80 = lshr i64 %79, 51
%81 = load i64, i64* %14
%82 = and i64 %81, 2251799813685247
%83 = add i64 %80, %82
store i64 %83, i64* %19
%84 = load i64, i64* %15
%85 = and i64 %84, 2251799813685247
store i64 %85, i64* %20
%86 = load i64, i64* %16
%87 = and i64 %86, 2251799813685247
store i64 %87, i64* %21
%88 = load i64, i64* %17
store i64 %88, i64* %22
%89 = load i64, i64* %18
store i64 %89, i64* %23
%90 = load i64, i64* %19
store i64 %90, i64* %24
%91 = load i64, i64* %20
store i64 %91, i64* %25
%92 = load i64, i64* %21
store i64 %92, i64* %26
%93 = load i64, i64* %3
%94 = add i64 %93, 0
%95 = trunc i64 %94 to i32
%96 = load i64, i64* %22
%97 = call i32 @_br2_store(i32 %95, i64 %96, i32 8)
%98 = load i64, i64* %3
%99 = add i64 %98, 8
%100 = trunc i64 %99 to i32
%101 = load i64, i64* %23
%102 = call i32 @_br2_store(i32 %100, i64 %101, i32 8)
%103 = load i64, i64* %3
%104 = add i64 %103, 16
%105 = trunc i64 %104 to i32
%106 = load i64, i64* %24
%107 = call i32 @_br2_store(i32 %105, i64 %106, i32 8)
%108 = load i64, i64* %3
%109 = add i64 %108, 24
%110 = trunc i64 %109 to i32
%111 = load i64, i64* %25
%112 = call i32 @_br2_store(i32 %110, i64 %111, i32 8)
%113 = load i64, i64* %3
%114 = add i64 %113, 32
%115 = trunc i64 %114 to i32
%116 = load i64, i64* %26
%117 = call i32 @_br2_store(i32 %115, i64 %116, i32 8)
ret void
}

LLVM IR (-O2):
define void @internal_fiat_25519_carry(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = tail call i64 @_br2_load(i32 %3, i32 8)
%5 = add i32 %3, 8
%6 = tail call i64 @_br2_load(i32 %5, i32 8)
%7 = add i32 %3, 16
%8 = tail call i64 @_br2_load(i32 %7, i32 8)
%9 = add i32 %3, 24
%10 = tail call i64 @_br2_load(i32 %9, i32 8)
%11 = add i32 %3, 32
%12 = tail call i64 @_br2_load(i32 %11, i32 8)
%13 = lshr i64 %4, 51
%14 = add i64 %13, %6
%15 = lshr i64 %14, 51
%16 = add i64 %15, %8
%17 = lshr i64 %16, 51
%18 = add i64 %17, %10
%19 = lshr i64 %18, 51
%20 = add i64 %19, %12
%21 = and i64 %4, 2251799813685247
%22 = lshr i64 %20, 51
%23 = mul nuw nsw i64 %22, 19
%24 = add nuw nsw i64 %23, %21
%25 = lshr i64 %24, 51
%26 = and i64 %14, 2251799813685247
%27 = add nuw nsw i64 %25, %26
%28 = and i64 %24, 2251799813685247
%29 = and i64 %27, 2251799813685247
%30 = lshr i64 %27, 51
%31 = and i64 %16, 2251799813685247
%32 = add nuw nsw i64 %30, %31
%33 = and i64 %18, 2251799813685247
%34 = and i64 %20, 2251799813685247
%35 = trunc i64 %0 to i32
%36 = tail call i32 @_br2_store(i32 %35, i64 %28, i32 8)
%37 = add i32 %35, 8
%38 = tail call i32 @_br2_store(i32 %37, i64 %29, i32 8)
%39 = add i32 %35, 16
%40 = tail call i32 @_br2_store(i32 %39, i64 %32, i32 8)
%41 = add i32 %35, 24
%42 = tail call i32 @_br2_store(i32 %41, i64 %33, i32 8)
%43 = add i32 %35, 32
%44 = tail call i32 @_br2_store(i32 %43, i64 %34, i32 8)
ret void
}