#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 darab(long, long);
long fab(long);
long fakt(long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  long int a, b, c, d, e, f, iFaktorial, iFibonacci, iTabie, iKombinasi;
  printf("Masukkan nombor Faktorial yang hendak dipaparkan: ");
  scanf("%d", &a);
  iFaktorial = fakt(a);
  printf("Faktorial bagi nombor %d ialah %d\n\n", a, iFaktorial);
  printf("Masukkan nombor Fibonacci yang hendak dipaparkan: ");
  scanf("%d", &b);
  iFibonacci = fab(b);
  printf("Fibonacci bagi nombor %d ialah %d\n\n", b, iFibonacci);
  printf("Masukkan nombor Tabie pertama: ");
  scanf("%d", &c);
  printf("Masukkan nombor Tabie kedua: ");
  scanf("%d", &d);
  iTabie = darab(c, d);
  printf("Nombor tabie bagi nombor %d ialah %d\n\n", a, iTabie);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fakt@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fab@plt>
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x48(%rbp),%rdx
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3d(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1f(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <darab@plt>
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x50(%rbp),%rdx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%rdi
call   1040 <fakt@plt>
mov    (%rsp),%rsi
lea    0xead(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rdi
call   1060 <fab@plt>
mov    0x8(%rsp),%rsi
lea    0xec9(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x18(%rsp),%rdi
mov    0x10(%rsp),%rsi
call   1070 <darab@plt>
mov    (%rsp),%rsi
lea    0xed1(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Masukkan nombor Faktorial yang hendak dipaparkan: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"Faktorial bagi nombor %d ialah %d\0A\0A\00"
@.str.3 = [51 x i8] c"Masukkan nombor Fibonacci yang hendak dipaparkan: \00"
@.str.4 = [36 x i8] c"Fibonacci bagi nombor %d ialah %d\0A\0A\00"
@.str.5 = [32 x i8] c"Masukkan nombor Tabie pertama: \00"
@.str.6 = [30 x i8] c"Masukkan nombor Tabie kedua: \00"
@.str.7 = [39 x i8] c"Nombor tabie bagi nombor %d ialah %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%14 = load i64, i64* %2
%15 = call i64 @fakt(i64 %14)
store i64 %15, i64* %8
%16 = load i64, i64* %2
%17 = load i64, i64* %8
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 %16, i64 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%21 = load i64, i64* %3
%22 = call i64 @fab(i64 %21)
store i64 %22, i64* %9
%23 = load i64, i64* %3
%24 = load i64, i64* %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i64 %23, i64 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %5)
%30 = load i64, i64* %4
%31 = load i64, i64* %5
%32 = call i64 @darab(i64 %30, i64 %31)
store i64 %32, i64* %10
%33 = load i64, i64* %2
%34 = load i64, i64* %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), i64 %33, i64 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"Masukkan nombor Faktorial yang hendak dipaparkan: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"Faktorial bagi nombor %d ialah %d\0A\0A\00"
@.str.3 = [51 x i8] c"Masukkan nombor Fibonacci yang hendak dipaparkan: \00"
@.str.4 = [36 x i8] c"Fibonacci bagi nombor %d ialah %d\0A\0A\00"
@.str.5 = [32 x i8] c"Masukkan nombor Tabie pertama: \00"
@.str.6 = [30 x i8] c"Masukkan nombor Tabie kedua: \00"
@.str.7 = [39 x i8] c"Nombor tabie bagi nombor %d ialah %d\0A\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %1 to i8*
%6 = bitcast i64* %2 to i8*
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%11 = load i64, i64* %1
%12 = call i64 @fakt(i64 %11)
%13 = load i64, i64* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 %13, i64 %12)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%17 = load i64, i64* %2
%18 = call i64 @fab(i64 %17)
%19 = load i64, i64* %2
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i64 %19, i64 %18)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%25 = load i64, i64* %3
%26 = load i64, i64* %4
%27 = call i64 @darab(i64 %25, i64 %26)
%28 = load i64, i64* %1
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), i64 %28, i64 %27)
ret i32 0
}