#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*/ _ssdm_SpecArrayDimSize(int *, int);
int /*<<< orphan*/ _ssdm_Unroll(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, char *);
int array_sum(int array[64], unsigned int length) {
  _ssdm_SpecArrayDimSize(array, 64);
  int sum = 0;
  for (int i = 0; i < 64; i++) {
    _ssdm_Unroll(0, 0, 0, "");
    sum += array[i];
  }
  return sum;
}


x86 assembly (clang, -O0):
<array_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x40,%esi
call   1040 <_ssdm_SpecArrayDimSize@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x40,-0x14(%rbp)
jge    1186 <array_sum+0x66>
xor    %edx,%edx
lea    0xea2(%rip),%rcx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <_ssdm_Unroll@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <array_sum+0x2b>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_sum>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    $0x40,%esi
call   1040 <_ssdm_SpecArrayDimSize@plt>
xor    %ebx,%ebx
lea    0xec3(%rip),%r14
xor    %ebp,%ebp
nop
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %r14,%rcx
call   1030 <_ssdm_Unroll@plt>
add    (%r15,%rbx,4),%ebp
add    $0x1,%rbx
cmp    $0x40,%rbx
jne    1140 <array_sum+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @array_sum(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = call i32 @_ssdm_SpecArrayDimSize(i32* %7, i32 64)
store i32 0, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %21, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 64
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = call i32 @_ssdm_Unroll(i32 0, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %5
%20 = add nsw i32 %19, %18
store i32 %20, i32* %5
br label %21
21: ; preds = %12
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %9
24: ; preds = %9
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @array_sum(i32* %0, i32 %1) {
%3 = tail call i32 @_ssdm_SpecArrayDimSize(i32* %0, i32 64)
br label %5
4: ; preds = %5
ret i32 %11
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %12, %5 ]
%7 = phi i32 [ 0, %2 ], [ %11, %5 ]
%8 = tail call i32 @_ssdm_Unroll(i32 0, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds i32, i32* %0, i64 %6
%10 = load i32, i32* %9
%11 = add nsw i32 %10, %7
%12 = add nuw nsw i64 %6, 1
%13 = icmp eq i64 %12, 64
br i1 %13, label %4, label %5
}