#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 int uint64_t;

/* Variables and functions */
int UINT64_C(int);
scalar_t__ UINT8_C(int);
void fiat_25519_carry(uint64_t out1[5], const uint64_t arg1[5]) {
  uint64_t x1 = (arg1[0]);
  uint64_t x2 = ((x1 >> 51) + (arg1[1]));
  uint64_t x3 = ((x2 >> 51) + (arg1[2]));
  uint64_t x4 = ((x3 >> 51) + (arg1[3]));
  uint64_t x5 = ((x4 >> 51) + (arg1[4]));
  uint64_t x6 = ((x1 & UINT64_C(0x7ffffffffffff)) +
                 ((x5 >> 51) * (uint64_t)UINT8_C(0x13)));
  uint64_t x7 = ((x6 >> 51) + (x2 & UINT64_C(0x7ffffffffffff)));
  uint64_t x8 = (x6 & UINT64_C(0x7ffffffffffff));
  uint64_t x9 = (x7 & UINT64_C(0x7ffffffffffff));
  uint64_t x10 = ((x7 >> 51) + (x3 & UINT64_C(0x7ffffffffffff)));
  uint64_t x11 = (x4 & UINT64_C(0x7ffffffffffff));
  uint64_t x12 = (x5 & UINT64_C(0x7ffffffffffff));
  out1[0] = x8;
  out1[1] = x9;
  out1[2] = x10;
  out1[3] = x11;
  out1[4] = x12;
}


x86 assembly (clang, -O0):
<fiat_25519_carry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    -0x10(%rbp),%rcx
add    0x4(%rcx),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    -0x10(%rbp),%rcx
add    0x8(%rcx),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    -0x10(%rbp),%rcx
add    0xc(%rcx),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    -0x10(%rbp),%rcx
add    0x10(%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x64(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    %eax,-0x68(%rbp)
mov    $0x13,%edi
call   1040 <UINT8_C@plt>
mov    -0x68(%rbp),%ecx
mov    %rax,%rdx
mov    -0x64(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    -0x60(%rbp),%ecx
mov    %eax,%edx
mov    -0x5c(%rbp),%eax
and    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x33,%ecx
sar    %cl,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    -0x50(%rbp),%ecx
mov    %eax,%edx
mov    -0x4c(%rbp),%eax
and    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x3c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x40(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_25519_carry>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    $0x13,%edi
call   1040 <UINT8_C@plt>
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    $0xffffffff,%edi
pop    %rax
jmp    1030 <UINT64_C@plt>

LLVM IR (-O0):
define void @fiat_25519_carry(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = ashr i32 %20, 51
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = add nsw i32 %21, %24
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = ashr i32 %26, 51
%28 = load i32*, i32** %4
%29 = getelementptr inbounds i32, i32* %28, i64 2
%30 = load i32, i32* %29
%31 = add nsw i32 %27, %30
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = ashr i32 %32, 51
%34 = load i32*, i32** %4
%35 = getelementptr inbounds i32, i32* %34, i64 3
%36 = load i32, i32* %35
%37 = add nsw i32 %33, %36
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = ashr i32 %38, 51
%40 = load i32*, i32** %4
%41 = getelementptr inbounds i32, i32* %40, i64 4
%42 = load i32, i32* %41
%43 = add nsw i32 %39, %42
store i32 %43, i32* %9
%44 = load i32, i32* %5
%45 = call i32 @UINT64_C(i32 -1)
%46 = and i32 %44, %45
%47 = load i32, i32* %9
%48 = ashr i32 %47, 51
%49 = call i64 @UINT8_C(i32 19)
%50 = trunc i64 %49 to i32
%51 = mul nsw i32 %48, %50
%52 = add nsw i32 %46, %51
store i32 %52, i32* %10
%53 = load i32, i32* %10
%54 = ashr i32 %53, 51
%55 = load i32, i32* %6
%56 = call i32 @UINT64_C(i32 -1)
%57 = and i32 %55, %56
%58 = add nsw i32 %54, %57
store i32 %58, i32* %11
%59 = load i32, i32* %10
%60 = call i32 @UINT64_C(i32 -1)
%61 = and i32 %59, %60
store i32 %61, i32* %12
%62 = load i32, i32* %11
%63 = call i32 @UINT64_C(i32 -1)
%64 = and i32 %62, %63
store i32 %64, i32* %13
%65 = load i32, i32* %11
%66 = ashr i32 %65, 51
%67 = load i32, i32* %7
%68 = call i32 @UINT64_C(i32 -1)
%69 = and i32 %67, %68
%70 = add nsw i32 %66, %69
store i32 %70, i32* %14
%71 = load i32, i32* %8
%72 = call i32 @UINT64_C(i32 -1)
%73 = and i32 %71, %72
store i32 %73, i32* %15
%74 = load i32, i32* %9
%75 = call i32 @UINT64_C(i32 -1)
%76 = and i32 %74, %75
store i32 %76, i32* %16
%77 = load i32, i32* %12
%78 = load i32*, i32** %3
%79 = getelementptr inbounds i32, i32* %78, i64 0
store i32 %77, i32* %79
%80 = load i32, i32* %13
%81 = load i32*, i32** %3
%82 = getelementptr inbounds i32, i32* %81, i64 1
store i32 %80, i32* %82
%83 = load i32, i32* %14
%84 = load i32*, i32** %3
%85 = getelementptr inbounds i32, i32* %84, i64 2
store i32 %83, i32* %85
%86 = load i32, i32* %15
%87 = load i32*, i32** %3
%88 = getelementptr inbounds i32, i32* %87, i64 3
store i32 %86, i32* %88
%89 = load i32, i32* %16
%90 = load i32*, i32** %3
%91 = getelementptr inbounds i32, i32* %90, i64 4
store i32 %89, i32* %91
ret void
}

LLVM IR (-O2):
define void @fiat_25519_carry(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = tail call i32 @UINT64_C(i32 -1)
%4 = tail call i64 @UINT8_C(i32 19)
%5 = tail call i32 @UINT64_C(i32 -1)
%6 = tail call i32 @UINT64_C(i32 -1)
%7 = tail call i32 @UINT64_C(i32 -1)
%8 = tail call i32 @UINT64_C(i32 -1)
%9 = tail call i32 @UINT64_C(i32 -1)
%10 = tail call i32 @UINT64_C(i32 -1)
ret void
}