#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*/ load_int(unsigned char *, int, unsigned int *);
int load_intarray(unsigned char *c, int n, int nbytes, unsigned int *l) {
  int i;
  for (i = 0; i < n; i++)
    load_int(c + nbytes * i, nbytes, l + i);
  return nbytes * n;
}


x86 assembly (clang, -O0):
<load_intarray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116e <load_intarray+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
call   1030 <load_int@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <load_intarray+0x1d>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_intarray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
test   %esi,%esi
jle    115b <load_intarray+0x4b>
mov    %rcx,%rbp
mov    %rdi,%rbx
movslq %r15d,%r12
mov    %r14d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
call   1030 <load_int@plt>
add    %r12,%rbx
add    $0x4,%rbp
add    $0xffffffffffffffff,%r13
jne    1140 <load_intarray+0x30>
imul   %r14d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @load_intarray(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
store i32 0, i32* %9
br label %10
10: ; preds = %27, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %30
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i32, i32* %7
%17 = load i32, i32* %9
%18 = mul nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %15, i64 %19
%21 = load i32, i32* %7
%22 = load i32*, i32** %8
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = call i32 @load_int(i8* %20, i32 %21, i32* %25)
br label %27
27: ; preds = %14
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
store i32 %29, i32* %9
br label %10
30: ; preds = %10
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = mul nsw i32 %31, %32
ret i32 %33
}

LLVM IR (-O2):
define i32 @load_intarray(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %17
6: ; preds = %4
%7 = sext i32 %2 to i64
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %15, %9 ]
%11 = mul nsw i64 %10, %7
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = getelementptr inbounds i32, i32* %3, i64 %10
%14 = tail call i32 @load_int(i8* %12, i32 %2, i32* %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %4
%18 = mul nsw i32 %2, %1
ret i32 %18
}