#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 */
long long INT_MAX;
int /*<<< orphan*/ free(char *);
char *init_str(long long);
int /*<<< orphan*/ print_all(char *, long long, long long, long long);
void gna(long long number) {
  char *str;
  long long rem;
  long long round;
  long long page_size;
  page_size = (number > INT_MAX) ? INT_MAX : number;
  str = init_str(page_size);
  round = number / page_size;
  rem = number % page_size;
  print_all(str, page_size, round, rem);
  free(str);
}


x86 assembly (clang, -O0):
<gna>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
jle    1163 <gna+0x33>
mov    0x2e91(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    116b <gna+0x3b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <init_str@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x28(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x28(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1050 <print_all@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gna>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    0x2ea9(%rip),%rax
mov    (%rax),%rbx
cmp    %rdi,%rbx
cmovge %rdi,%rbx
mov    %rbx,%rdi
call   1040 <init_str@plt>
mov    %rax,%r14
mov    %r15,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     116d <gna+0x3d>
mov    %r15,%rax
cqto
idiv   %rbx
mov    %rdx,%rcx
jmp    1176 <gna+0x46>
mov    %r15d,%eax
xor    %edx,%edx
div    %ebx
mov    %edx,%ecx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <print_all@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@INT_MAX = global i64 0
define void @gna(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %2
%7 = load i64, i64* %2
%8 = load i64, i64* @INT_MAX
%9 = icmp sgt i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i64, i64* @INT_MAX
br label %14
12: ; preds = %1
%13 = load i64, i64* %2
br label %14
14: ; preds = %12, %10
%15 = phi i64 [ %11, %10 ], [ %13, %12 ]
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = call i8* @init_str(i64 %16)
store i8* %17, i8** %3
%18 = load i64, i64* %2
%19 = load i64, i64* %6
%20 = sdiv i64 %18, %19
store i64 %20, i64* %5
%21 = load i64, i64* %2
%22 = load i64, i64* %6
%23 = srem i64 %21, %22
store i64 %23, i64* %4
%24 = load i8*, i8** %3
%25 = load i64, i64* %6
%26 = load i64, i64* %5
%27 = load i64, i64* %4
%28 = call i32 @print_all(i8* %24, i64 %25, i64 %26, i64 %27)
%29 = load i8*, i8** %3
%30 = call i32 @free(i8* %29)
ret void
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define void @gna(i64 %0) {
%2 = load i64, i64* @INT_MAX
%3 = icmp slt i64 %2, %0
%4 = select i1 %3, i64 %2, i64 %0
%5 = tail call i8* @init_str(i64 %4)
%6 = sdiv i64 %0, %4
%7 = srem i64 %0, %4
%8 = tail call i32 @print_all(i8* %5, i64 %4, i64 %6, i64 %7)
%9 = tail call i32 @free(i8* %5)
ret void
}