#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*/ die(char *);
int pages(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main() {
  unsigned input1, input2;
  printf("Input the number of lines that can be printed on one page: ");
  if (!scanf("%u", &input1))
    die("Input failure.\n");
  printf("Input the number of lines we want to print: ");
  if (!scanf("%u", &input2))
    die("Input failure.\n");
  printf("The number of pages required for %u number of lines with %u lines "
         "per page is %u.\n",
         input2, input1, pages(input1, input2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%eax
jne    1182 <main+0x42>
lea    0xec2(%rip),%rdi
call   1060 <die@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%eax
jne    11b5 <main+0x75>
lea    0xe8f(%rip),%rdi
call   1060 <die@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <pages@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jne    1172 <main+0x32>
lea    0xed2(%rip),%rdi
call   1060 <die@plt>
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jne    119f <main+0x5f>
lea    0xea5(%rip),%rdi
call   1060 <die@plt>
mov    (%rsp),%ebx
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <pages@plt>
lea    0xec6(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Input the number of lines that can be printed on one page: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [16 x i8] c"Input failure.\0A\00"
@.str.3 = [45 x i8] c"Input the number of lines we want to print: \00"
@.str.4 = [83 x i8] c"The number of pages required for %u number of lines with %u lines per page is %u.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @pages(i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %17, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [60 x i8] c"Input the number of lines that can be printed on one page: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [16 x i8] c"Input failure.\0A\00"
@.str.3 = [45 x i8] c"Input the number of lines we want to print: \00"
@.str.4 = [83 x i8] c"The number of pages required for %u number of lines with %u lines per page is %u.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
%17 = load i32, i32* %2
%18 = load i32, i32* %1
%19 = call i32 @pages(i32 %18, i32 %17)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
ret i32 0
}