#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void blockWriteINT(FILE *output, char *label, int *myvector, int first,
                   int last) {
  int i, k = 0;
  fprintf(output, "%s", label);
  fprintf(output, "\n");
  for (i = first; i <= last; i++) {
    fprintf(output, " %5d", myvector[i]);
    k++;
    if (k % 12 == 0) {
      fprintf(output, "\n");
      k = 0;
    }
  }
  if (k % 12 != 0)
    fprintf(output, "\n");
}


x86 assembly (clang, -O0):
<blockWriteINT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11d2 <blockWriteINT+0xc2>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11bf <blockWriteINT+0xaf>
mov    -0x8(%rbp),%rdi
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x28(%rbp)
jmp    11c4 <blockWriteINT+0xb4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1160 <blockWriteINT+0x50>
mov    -0x28(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11f8 <blockWriteINT+0xe8>
mov    -0x8(%rbp),%rdi
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockWriteINT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%ebx
mov    %rdx,%r15
mov    %rdi,%r12
mov    %rsi,%rdi
mov    %r12,%rsi
call   1030 <fputs@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
cmp    %r14d,%ebx
jg     1204 <blockWriteINT+0xd4>
movslq %ebx,%rax
lea    (%r15,%rax,4),%r13
sub    %ebx,%r14d
add    $0x1,%r14d
lea    0xe84(%rip),%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1199 <blockWriteINT+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    %ebp,%r14d
je     11d4 <blockWriteINT+0xa4>
mov    0x0(%r13,%rbp,4),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebx
imul   $0xaaaaaaab,%ebx,%eax
add    $0x2aaaaaa8,%eax
ror    $0x2,%eax
cmp    $0x15555554,%eax
ja     1190 <blockWriteINT+0x60>
mov    $0xa,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
xor    %ebx,%ebx
jmp    1190 <blockWriteINT+0x60>
imul   $0xaaaaaaab,%ebx,%eax
add    $0x2aaaaaa8,%eax
ror    $0x2,%eax
cmp    $0x15555555,%eax
jb     1204 <blockWriteINT+0xd4>
mov    $0xa,%edi
mov    %r12,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputc@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c" %5d\00"
define void @blockWriteINT(i32* %0, i8* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %12
%13 = load i32*, i32** %6
%14 = load i8*, i8** %7
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %6
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* %9
store i32 %18, i32* %11
br label %19
19: ; preds = %40, %5
%20 = load i32, i32* %11
%21 = load i32, i32* %10
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %43
23: ; preds = %19
%24 = load i32*, i32** %6
%25 = load i32*, i32** %8
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %12
%32 = add nsw i32 %31, 1
store i32 %32, i32* %12
%33 = load i32, i32* %12
%34 = srem i32 %33, 12
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %23
%37 = load i32*, i32** %6
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %12
br label %39
39: ; preds = %36, %23
br label %40
40: ; preds = %39
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 1
store i32 %42, i32* %11
br label %19
43: ; preds = %19
%44 = load i32, i32* %12
%45 = srem i32 %44, 12
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i32*, i32** %6
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %47, %43
ret void
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c" %5d\00"
define void @blockWriteINT(i32* nocapture %0, i8* nocapture %1, i32* nocapture %2, i32 %3, i32 %4) {
%6 = tail call i32 @fputs(i8* %1, i32* %0)
%7 = tail call i32 @fputc(i32 10, i32* %0)
%8 = icmp sgt i32 %3, %4
br i1 %8, label %33, label %9
9: ; preds = %5
%10 = sext i32 %3 to i64
%11 = add i32 %4, 1
br label %12
12: ; preds = %9, %23
%13 = phi i64 [ %10, %9 ], [ %25, %23 ]
%14 = phi i32 [ 0, %9 ], [ %24, %23 ]
%15 = getelementptr inbounds i32, i32* %2, i64 %13
%16 = load i32, i32* %15
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nsw i32 %14, 1
%19 = srem i32 %18, 12
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = tail call i32 @fputc(i32 10, i32* %0)
br label %23
23: ; preds = %12, %21
%24 = phi i32 [ 0, %21 ], [ %18, %12 ]
%25 = add nsw i64 %13, 1
%26 = trunc i64 %25 to i32
%27 = icmp eq i32 %11, %26
br i1 %27, label %28, label %12
28: ; preds = %23
%29 = srem i32 %24, 12
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 @fputc(i32 10, i32* %0)
br label %33
33: ; preds = %5, %31, %28
ret void
}