#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ KAPI_save_as_header_bv32(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ KAPI_save_as_header_bv32_list(int /*<<< orphan*/ *, int);
void KAPI_save_as_header_bv32_array(FILE *fp, int *pint,
                                    int number_of_elements) {
  int i;
  FILE *fpTmp = fp;
  for (i = 0; i < number_of_elements - 1; i++)
    KAPI_save_as_header_bv32_list(fp, pint[i]);
  KAPI_save_as_header_bv32(fp, pint[i]);
}


x86 assembly (clang, -O0):
<KAPI_save_as_header_bv32_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1175 <KAPI_save_as_header_bv32_array+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1040 <KAPI_save_as_header_bv32_list@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1142 <KAPI_save_as_header_bv32_array+0x22>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <KAPI_save_as_header_bv32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KAPI_save_as_header_bv32_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
cmp    $0x2,%edx
jl     1157 <KAPI_save_as_header_bv32_array+0x37>
add    $0xffffffff,%edx
mov    %edx,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1040 <KAPI_save_as_header_bv32_list@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <KAPI_save_as_header_bv32_array+0x20>
jmp    115a <KAPI_save_as_header_bv32_array+0x3a>
xor    %r12d,%r12d
mov    (%r14,%r12,4),%esi
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <KAPI_save_as_header_bv32@plt>

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

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