#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 *, ...);
void printIntArray(void *array, size_t low, size_t high) {
  for (size_t i = low; i <= high; i++)
    printf("%d ", ((int *)array)[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<printIntArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     1164 <printIntArray+0x54>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <printIntArray+0x1c>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printIntArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    %rdx,%rsi
ja     1157 <printIntArray+0x37>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xec3(%rip),%r12
nopl   (%rax)
mov    (%r15,%rbx,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %r14,%rbx
jbe    1140 <printIntArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printIntArray(i8* nocapture %0, i64 %1, i64 %2) {
%4 = icmp ugt i64 %1, %2
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = bitcast i8* %0 to i32*
br label %9
7: ; preds = %9, %3
%8 = tail call i32 @putchar(i32 10)
ret void
9: ; preds = %5, %9
%10 = phi i64 [ %1, %5 ], [ %14, %9 ]
%11 = getelementptr inbounds i32, i32* %6, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add i64 %10, 1
%15 = icmp ugt i64 %14, %2
br i1 %15, label %7, label %9
}