void ivecdump(vec, len, head) int *vec;
int len;
char *head;
{
  register int i, j, count;
  int lenmod, lenrem;
  lenmod = len / 9;
  lenrem = len - lenmod * 6;
  printf("%s\n", head);
  count = 0;
  for (j = 0; j < lenmod; j++) {
    printf("%3d|", count);
    for (i = 0; i < 9; i++, vec++, count++)
      printf("%8d", *vec);
    printf("\n");
  }
  if (lenrem) {
    printf("%3d|", count);
    for (i = 0; i < lenrem; i++, vec++)
      printf("%8d", *vec);
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<ivecdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
imul   $0x6,-0x28(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11de <ivecdump+0xce>
mov    -0x24(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jge    11c2 <ivecdump+0xb2>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1181 <ivecdump+0x71>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115d <ivecdump+0x4d>
cmpl   $0x0,-0x2c(%rbp)
je     1248 <ivecdump+0x138>
mov    -0x24(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    123a <ivecdump+0x12a>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    1200 <ivecdump+0xf0>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivecdump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
movslq %esi,%r14
imul   $0x38e38e39,%r14,%r13
mov    %r13,%rax
shr    $0x3f,%rax
sar    $0x21,%r13
add    %eax,%r13d
lea    0x0(%r13,%r13,1),%eax
lea    (%rax,%rax,2),%eax
mov    %r14d,%r12d
sub    %eax,%r12d
mov    %rdx,%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
cmp    $0x9,%r14d
jl     122b <ivecdump+0xfb>
lea    0xe81(%rip),%r14
lea    0xe7f(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x24,%rbx
add    $0x9,%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r13d
jne    1190 <ivecdump+0x60>
test   %r12d,%r12d
je     1280 <ivecdump+0x150>
lea    0xdc9(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
jle    1276 <ivecdump+0x146>
mov    %r12d,%r15d
lea    0xdb6(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %ebp,%r15d
jne    1260 <ivecdump+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"%3d|\00"
@.str.2 = [4 x i8] c"%8d\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @ivecdump(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%12 = load i32, i32* %5
%13 = sdiv i32 %12, 9
store i32 %13, i32* %10
%14 = load i32, i32* %5
%15 = load i32, i32* %10
%16 = mul nsw i32 %15, 6
%17 = sub nsw i32 %14, %16
store i32 %17, i32* %11
%18 = load i8*, i8** %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 0, i32* %9
store i32 0, i32* %8
br label %20
20: ; preds = %43, %3
%21 = load i32, i32* %8
%22 = load i32, i32* %10
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %46
24: ; preds = %20
%25 = load i32, i32* %9
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %25)
store i32 0, i32* %7
br label %27
27: ; preds = %34, %24
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 9
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load i32*, i32** %4
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %30
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
%37 = load i32*, i32** %4
%38 = getelementptr inbounds i32, i32* %37, i32 1
store i32* %38, i32** %4
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %27
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %20
46: ; preds = %20
%47 = load i32, i32* %11
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %67
49: ; preds = %46
%50 = load i32, i32* %9
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %50)
store i32 0, i32* %7
br label %52
52: ; preds = %60, %49
%53 = load i32, i32* %7
%54 = load i32, i32* %11
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %65
56: ; preds = %52
%57 = load i32*, i32** %4
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %56
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
%63 = load i32*, i32** %4
%64 = getelementptr inbounds i32, i32* %63, i32 1
store i32* %64, i32** %4
br label %52
65: ; preds = %52
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %67
67: ; preds = %65, %46
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%3d|\00"
@.str.2 = [4 x i8] c"%8d\00"
define void @ivecdump(i32* nocapture %0, i32 %1, i8* nocapture %2) {
%4 = sdiv i32 %1, 9
%5 = mul nsw i32 %4, -6
%6 = add i32 %5, %1
%7 = tail call i32 @puts(i8* dereferenceable(1) %2)
%8 = icmp sgt i32 %1, 8
br i1 %8, label %9, label %45
9: ; preds = %3, %9
%10 = phi i32* [ %40, %9 ], [ %0, %3 ]
%11 = phi i32 [ %41, %9 ], [ 0, %3 ]
%12 = phi i32 [ %43, %9 ], [ 0, %3 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%14 = load i32, i32* %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds i32, i32* %10, i64 1
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds i32, i32* %10, i64 2
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds i32, i32* %10, i64 3
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds i32, i32* %10, i64 4
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds i32, i32* %10, i64 5
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds i32, i32* %10, i64 6
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds i32, i32* %10, i64 7
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds i32, i32* %10, i64 8
%38 = load i32, i32* %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds i32, i32* %10, i64 9
%41 = add nuw i32 %11, 9
%42 = tail call i32 @putchar(i32 10)
%43 = add nuw nsw i32 %12, 1
%44 = icmp eq i32 %43, %4
br i1 %44, label %45, label %9
45: ; preds = %9, %3
%46 = phi i32 [ 0, %3 ], [ %41, %9 ]
%47 = phi i32* [ %0, %3 ], [ %40, %9 ]
%48 = icmp eq i32 %6, 0
br i1 %48, label %62, label %49
49: ; preds = %45
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%51 = icmp sgt i32 %6, 0
br i1 %51, label %52, label %60
52: ; preds = %49, %52
%53 = phi i32* [ %58, %52 ], [ %47, %49 ]
%54 = phi i32 [ %57, %52 ], [ 0, %49 ]
%55 = load i32, i32* %53
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %55)
%57 = add nuw nsw i32 %54, 1
%58 = getelementptr inbounds i32, i32* %53, i64 1
%59 = icmp eq i32 %57, %6
br i1 %59, label %60, label %52
60: ; preds = %52, %49
%61 = tail call i32 @putchar(i32 10)
br label %62
62: ; preds = %60, %45
%63 = tail call i32 @putchar(i32 10)
ret void
}