#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*/ Section1(int);
int /*<<< orphan*/ Section2(int);
int /*<<< orphan*/ Section3(int);
int /*<<< orphan*/ Section4(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  printf("Insert a number between 1000 and 9999: ");
  scanf("%d", &number);
  number %= 10000;
  Section1(number);
  Section2(number);
  Section3(number);
  Section4(number);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <Section1@plt>
mov    -0x8(%rbp),%edi
call   1030 <Section2@plt>
mov    -0x8(%rbp),%edi
call   1070 <Section3@plt>
mov    -0x8(%rbp),%edi
call   1040 <Section4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
movslq 0x4(%rsp),%rdi
imul   $0x68db8bad,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%edi
mov    %edi,0x4(%rsp)
call   1060 <Section1@plt>
mov    0x4(%rsp),%edi
call   1030 <Section2@plt>
mov    0x4(%rsp),%edi
call   1070 <Section3@plt>
mov    0x4(%rsp),%edi
call   1040 <Section4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Insert a number between 1000 and 9999: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = srem i32 %5, 10000
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @Section1(i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @Section2(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @Section3(i32 %11)
%13 = load i32, i32* %2
%14 = call i32 @Section4(i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Insert a number between 1000 and 9999: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = srem i32 %5, 10000
store i32 %6, i32* %1
%7 = call i32 @Section1(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @Section2(i32 %8)
%10 = load i32, i32* %1
%11 = call i32 @Section3(i32 %10)
%12 = load i32, i32* %1
%13 = call i32 @Section4(i32 %12)
ret i32 0
}