#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 /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sum_pairs(int *, int, int **);
void main() {
  int array[4] = {1, 2, 3, 5}, i, b[2];
  sum_pairs(array, 5, &b);
  for (i = 0; i < 2; i++)
    printf("%d ", b[i]);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
mov    $0x5,%esi
call   1040 <sum_pairs@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1183 <main+0x63>
movslq -0x14(%rbp),%rax
mov    -0x1c(%rbp,%rax,4),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <main+0x37>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    $0x5,%esi
call   1040 <sum_pairs@plt>
mov    0x8(%rsp),%esi
lea    0xec0(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [4 x i32] [i32 1, i32 2, i32 3, i32 5]
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = bitcast [4 x i32]* %1 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = bitcast [2 x i32]* %3 to i32**
%7 = call i32 @sum_pairs(i32* %5, i32 5, i32** %6)
store i32 0, i32* %2
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %8
20: ; preds = %8
ret void
}

LLVM IR (-O2):
@__const.main.array = [4 x i32] [i32 1, i32 2, i32 3, i32 5]
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [4 x i32]
%2 = alloca i32*
%3 = bitcast i32** %2 to [2 x i32]*
%4 = bitcast [4 x i32]* %1 to i8*
%5 = bitcast i32** %2 to i8*
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%7 = call i32 @sum_pairs(i32* %6, i32 5, i32** %2)
%8 = bitcast i32** %2 to i32*
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret void
}