#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 int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void dumparray(int32_t arr[], int base, int last) {
  int i, count;
  count = last - base + 1;
  if (count > 0) {
    if (count > 1)
      for (i = 0; i < count - 1; ++i)
        printf("%i ", arr[base + i]);
    printf("%i", arr[last]);
  }
}


x86 assembly (clang, -O0):
<dumparray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11a0 <dumparray+0x90>
cmpl   $0x1,-0x18(%rbp)
jle    1189 <dumparray+0x79>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1184 <dumparray+0x74>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <dumparray+0x39>
jmp    1189 <dumparray+0x79>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumparray>:
mov    %edx,%eax
sub    %esi,%eax
js     1175 <dumparray+0x65>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rdi,%r14
je     1154 <dumparray+0x44>
movslq %esi,%rcx
mov    %eax,%r13d
lea    (%r14,%rcx,4),%rbx
xor    %ebp,%ebp
lea    0xec4(%rip),%r12
nopl   0x0(%rax)
mov    (%rbx,%rbp,4),%esi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1140 <dumparray+0x30>
movslq %r15d,%rax
mov    (%r14,%rax,4),%esi
lea    0xea2(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i \00"
@.str.1 = [3 x i8] c"%i\00"
define void @dumparray(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* %6
%10 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %44
15: ; preds = %3
%16 = load i32, i32* %8
%17 = icmp sgt i32 %16, 1
br i1 %17, label %18, label %37
18: ; preds = %15
store i32 0, i32* %7
br label %19
19: ; preds = %33, %18
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = sub nsw i32 %21, 1
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %36
24: ; preds = %19
%25 = load i32*, i32** %4
%26 = load i32, i32* %5
%27 = load i32, i32* %7
%28 = add nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %25, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %24
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %19
36: ; preds = %19
br label %37
37: ; preds = %36, %15
%38 = load i32*, i32** %4
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %37, %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i \00"
@.str.1 = [3 x i8] c"%i\00"
define void @dumparray(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sub i32 %2, %1
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %24
6: ; preds = %3
%7 = icmp eq i32 %4, 0
br i1 %7, label %19, label %8
8: ; preds = %6
%9 = sext i32 %1 to i64
%10 = zext i32 %4 to i64
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %17, %11 ]
%13 = add nsw i64 %12, %9
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11, %6
%20 = sext i32 %2 to i64
%21 = getelementptr inbounds i32, i32* %0, i64 %20
%22 = load i32, i32* %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %19, %3
ret void
}