#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void print_pages(int page, void *arg) {
  int *count = (int *)arg;
  fprintf(stdout, "%d ", page);
  if (*count % 16 == 15) {
    fprintf(stdout, "\n");
  }
  *count = *count + 1;
}


x86 assembly (clang, -O0):
<print_pages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0xf,%edx
jne    116f <print_pages+0x5f>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pages>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%edx
mov    0x2ec0(%rip),%r14
mov    (%r14),%edi
lea    0xed6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%eax
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
mov    %eax,%edx
sub    %ecx,%edx
cmp    $0xf,%edx
jne    115a <print_pages+0x4a>
mov    (%r14),%edi
lea    0xeb3(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%eax
add    $0x1,%eax
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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