#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 *, int);
int /*<<< orphan*/ putchar(char);
void print_arr(int *arr, const size_t len) {
  size_t i;
  for (i = 0; i < len; i++) {
    printf("%15d\t", arr[i]);
    if (i % 4 == 3)
      putchar('\n');
  }
  if (i % 4 != 0)
    putchar('\n');
}


x86 assembly (clang, -O0):
<print_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118f <print_arr+0x6f>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
and    $0x3,%rax
cmp    $0x3,%rax
jne    1179 <print_arr+0x59>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    117e <print_arr+0x5e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <print_arr+0x18>
mov    -0x18(%rbp),%rax
and    $0x3,%rax
cmp    $0x0,%rax
je     11ab <print_arr+0x8b>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arr>:
test   %rsi,%rsi
je     1185 <print_arr+0x65>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xec4(%rip),%r15
jmp    1149 <print_arr+0x29>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r12
je     1169 <print_arr+0x49>
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0x3,%al
jne    1140 <print_arr+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1140 <print_arr+0x20>
test   $0x3,%r12b
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
je     1185 <print_arr+0x65>
mov    $0xa,%edi
jmp    1030 <putchar@plt>
ret

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

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