#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 sum(int, int);
int sumlots(int a, int b, int c, int d, int e, int f, int g, int h, int i,
            int j, int k) {
  return sum(sum(sum(sum(a, b), sum(c, d)), sum(sum(e, f), sum(g, h))),
             sum(sum(i, j), k));
}


x86 assembly (clang, -O0):
<sumlots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <sum@plt>
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <sum@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%esi
call   1030 <sum@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <sum@plt>
mov    %eax,-0x24(%rbp)
mov    0x10(%rbp),%edi
mov    0x18(%rbp),%esi
call   1030 <sum@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   1030 <sum@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1030 <sum@plt>
mov    %eax,-0x1c(%rbp)
mov    0x20(%rbp),%edi
mov    0x28(%rbp),%esi
call   1030 <sum@plt>
mov    %eax,%edi
mov    0x30(%rbp),%esi
call   1030 <sum@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1030 <sum@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumlots>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x8(%rsp)
mov    %r8d,%ebp
mov    %ecx,%ebx
mov    %edx,%r14d
mov    0x70(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x60(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x68(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x50(%rsp),%r15d
mov    0x58(%rsp),%r12d
call   1030 <sum@plt>
mov    %eax,%r13d
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <sum@plt>
mov    %r13d,%edi
mov    %eax,%esi
call   1030 <sum@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    0x8(%rsp),%esi
call   1030 <sum@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    %r12d,%esi
call   1030 <sum@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <sum@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <sum@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1030 <sum@plt>
mov    %eax,%edi
mov    0x14(%rsp),%esi
call   1030 <sum@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <sum@plt>

LLVM IR (-O0):
define i32 @sumlots(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i32 %0, i32* %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store i32 %10, i32* %22
%23 = load i32, i32* %12
%24 = load i32, i32* %13
%25 = call i32 @sum(i32 %23, i32 %24)
%26 = load i32, i32* %14
%27 = load i32, i32* %15
%28 = call i32 @sum(i32 %26, i32 %27)
%29 = call i32 @sum(i32 %25, i32 %28)
%30 = load i32, i32* %16
%31 = load i32, i32* %17
%32 = call i32 @sum(i32 %30, i32 %31)
%33 = load i32, i32* %18
%34 = load i32, i32* %19
%35 = call i32 @sum(i32 %33, i32 %34)
%36 = call i32 @sum(i32 %32, i32 %35)
%37 = call i32 @sum(i32 %29, i32 %36)
%38 = load i32, i32* %20
%39 = load i32, i32* %21
%40 = call i32 @sum(i32 %38, i32 %39)
%41 = load i32, i32* %22
%42 = call i32 @sum(i32 %40, i32 %41)
%43 = call i32 @sum(i32 %37, i32 %42)
ret i32 %43
}

LLVM IR (-O2):
define i32 @sumlots(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = tail call i32 @sum(i32 %0, i32 %1)
%13 = tail call i32 @sum(i32 %2, i32 %3)
%14 = tail call i32 @sum(i32 %12, i32 %13)
%15 = tail call i32 @sum(i32 %4, i32 %5)
%16 = tail call i32 @sum(i32 %6, i32 %7)
%17 = tail call i32 @sum(i32 %15, i32 %16)
%18 = tail call i32 @sum(i32 %14, i32 %17)
%19 = tail call i32 @sum(i32 %8, i32 %9)
%20 = tail call i32 @sum(i32 %19, i32 %10)
%21 = tail call i32 @sum(i32 %18, i32 %20)
ret i32 %21
}