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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void __print_u32(void *cc, void *v) {
  uint32_t *n = cc;
  (*n)++;
  fprintf(stdout, "%4u", *(uint32_t *)v);
  if (*n >= 16) {
    fprintf(stdout, "\n");
    *n = 0;
  }
}


x86 assembly (clang, -O0):
<__print_u32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
cmpl   $0x10,(%rax)
jl     117e <__print_u32+0x6e>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__print_u32>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
addl   $0x1,(%rdi)
mov    0x2ebf(%rip),%r14
mov    (%r14),%edi
mov    (%rsi),%edx
lea    0xed3(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmpl   $0x10,(%rbx)
jl     1150 <__print_u32+0x40>
mov    (%r14),%edi
lea    0xec1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
movl   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%4u\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @__print_u32(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
%11 = load i32, i32* @stdout
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = icmp sge i32 %17, 16
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load i32, i32* @stdout
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32*, i32** %5
store i32 0, i32* %22
br label %23
23: ; preds = %19, %2
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%4u\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @__print_u32(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = load i32, i32* @stdout
%7 = bitcast i8* %1 to i32*
%8 = load i32, i32* %7
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 15
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @stdout
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %15
15: ; preds = %12, %2
ret void
}