#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 char *uint64_t;

/* Variables and functions */
uint64_t add_scalar(uint64_t *out, uint64_t *f1, uint64_t f2) {
  uint64_t carry_r;
  asm volatile("  xor %%r8d, %%r8d;"
               "  xor %%r9d, %%r9d;"
               "  xor %%r10d, %%r10d;"
               "  xor %%r11d, %%r11d;"
               "  xor %k1, %k1;"
               "  addq 0(%3), %0;"
               "  movq %0, 0(%2);"
               "  adcxq 8(%3), %%r8;"
               "  movq %%r8, 8(%2);"
               "  adcxq 16(%3), %%r9;"
               "  movq %%r9, 16(%2);"
               "  adcxq 24(%3), %%r10;"
               "  movq %%r10, 24(%2);"
               "  adcx %%r11, %1;"
               : "+&r"(f2), "=&r"(carry_r)
               : "r"(out), "r"(f1)
               : "%r8", "%r9", "%r10", "%r11", "memory", "cc");
  return carry_r;
}


x86 assembly (clang, -O0):
<add_scalar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rsi
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %r10d,%r10d
xor    %r11d,%r11d
xor    %eax,%eax
add    (%rsi),%rcx
mov    %rcx,(%rdx)
adcx   0x8(%rsi),%r8
mov    %r8,0x8(%rdx)
adcx   0x10(%rsi),%r9
mov    %r9,0x10(%rdx)
adcx   0x18(%rsi),%r10
mov    %r10,0x18(%rdx)
adcx   %r11,%rax
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_scalar>:
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %r10d,%r10d
xor    %r11d,%r11d
xor    %eax,%eax
add    (%rsi),%rdx
mov    %rdx,(%rdi)
adcx   0x8(%rsi),%r8
mov    %r8,0x8(%rdi)
adcx   0x10(%rsi),%r9
mov    %r9,0x10(%rdi)
adcx   0x18(%rsi),%r10
mov    %r10,0x18(%rdi)
adcx   %r11,%rax
ret

LLVM IR (-O0):
define i8* @add_scalar(i8** %0, i8** %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = load i8**, i8*** %4
%10 = load i8**, i8*** %5
%11 = call { i8*, i8* } asm sideeffect " xor %r8d, %r8d; xor %r9d, %r9d; xor %r10d, %r10d; xor %r11d, %r11d; xor ${1:k}, ${1:k}; addq 0($3), $0; movq $0, 0($2); adcxq 8($3), %r8; movq %r8, 8($2); adcxq 16($3), %r9; movq %r9, 16($2); adcxq 24($3), %r10; movq %r10, 24($2); adcx %r11, $1;", "=&r,=&r,r,r,0,~{r8},~{r9},~{r10},~{r11},~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i8** %9, i8** %10, i8* %8)
%12 = extractvalue { i8*, i8* } %11, 0
%13 = extractvalue { i8*, i8* } %11, 1
store i8* %12, i8** %6
store i8* %13, i8** %7
%14 = load i8*, i8** %7
ret i8* %14
}

LLVM IR (-O2):
define i8* @add_scalar(i8** %0, i8** %1, i8* %2) {
%4 = tail call { i8*, i8* } asm sideeffect " xor %r8d, %r8d; xor %r9d, %r9d; xor %r10d, %r10d; xor %r11d, %r11d; xor ${1:k}, ${1:k}; addq 0($3), $0; movq $0, 0($2); adcxq 8($3), %r8; movq %r8, 8($2); adcxq 16($3), %r9; movq %r9, 16($2); adcxq 24($3), %r10; movq %r10, 24($2); adcx %r11, $1;", "=&r,=&r,r,r,0,~{r8},~{r9},~{r10},~{r11},~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i8** %0, i8** %1, i8* %2)
%5 = extractvalue { i8*, i8* } %4, 1
ret i8* %5
}