void print_ivect(m, rsize1, rsize2) int *m;
int rsize1, rsize2;
{
  int i;
  putchar('{');
  for (i = rsize1; i < rsize2; i++)
    printf("%d  ", m[i]);
  printf("%d}\n", m[rsize2]);
}


x86 assembly (clang, -O0):
<print_ivect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x7b,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1177 <print_ivect+0x57>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <print_ivect+0x24>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ivect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%r14
mov    $0x7b,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
cmp    %r15d,%r12d
jge    1177 <print_ivect+0x57>
movslq %r12d,%rax
lea    (%r14,%rax,4),%r13
mov    %r15d,%ebx
sub    %r12d,%ebx
lea    0xea7(%rip),%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %ebp,%ebx
jne    1160 <print_ivect+0x40>
movslq %r15d,%rax
mov    (%r14,%rax,4),%esi
lea    0xe80(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

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

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