#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("Enter number: ");
  scanf("%d", &a);
  long long int n, x = 0, y = 1, z;
  for (n = 1; n < a; n++) {
    z = y;
    y = x + y;
    x = z;
    if (x < 0) {
      printf("...\n...\nCannot calculate more than %lld!\n...\n...\n", n);
      return 0;
    }
  }
  printf("The num is: %lld\n\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jge    11d1 <main+0xb1>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    11bb <main+0x9b>
mov    -0x10(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <main+0xca>
jmp    11c0 <main+0xa0>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1165 <main+0x45>
mov    -0x18(%rbp),%rsi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rcx
cmp    $0x2,%rcx
jl     11c2 <main+0xa2>
lea    -0x1(%rcx),%rsi
add    $0xfffffffffffffffe,%rcx
mov    %esi,%eax
and    $0x7,%eax
cmp    $0x7,%rcx
jae    116d <main+0x4d>
mov    $0x1,%edx
xor    %ecx,%ecx
jmp    119e <main+0x7e>
and    $0xfffffffffffffff8,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
add    %rdx,%rcx
add    %rcx,%rdx
add    %rdx,%rcx
add    %rcx,%rdx
add    %rdx,%rcx
add    %rcx,%rdx
add    %rdx,%rcx
add    %rcx,%rdx
add    $0xfffffffffffffff8,%rsi
jne    1180 <main+0x60>
mov    %rcx,%rbx
test   %rax,%rax
je     11c2 <main+0xa2>
cs nopw 0x0(%rax,%rax,1)
mov    %rdx,%rbx
add    %rdx,%rcx
mov    %rcx,%rdx
mov    %rbx,%rcx
add    $0xffffffffffffffff,%rax
jne    11b0 <main+0x90>
lea    0xe49(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"...\0A...\0ACannot calculate more than %lld!\0A...\0A...\0A\00"
@.str.3 = [19 x i8] c"The num is: %lld\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i64 0, i64* %4
store i64 1, i64* %5
store i64 1, i64* %3
br label %9
9: ; preds = %26, %0
%10 = load i64, i64* %3
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = icmp slt i64 %10, %12
br i1 %13, label %14, label %29
14: ; preds = %9
%15 = load i64, i64* %5
store i64 %15, i64* %6
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = add nsw i64 %16, %17
store i64 %18, i64* %5
%19 = load i64, i64* %6
store i64 %19, i64* %4
%20 = load i64, i64* %4
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i64, i64* %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i64 %23)
store i32 0, i32* %1
br label %32
25: ; preds = %14
br label %26
26: ; preds = %25
%27 = load i64, i64* %3
%28 = add nsw i64 %27, 1
store i64 %28, i64* %3
br label %9
29: ; preds = %9
%30 = load i64, i64* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i64 %30)
store i32 0, i32* %1
br label %32
32: ; preds = %29, %22
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"The num is: %lld\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 = sext i32 %5 to i64
%7 = icmp sgt i32 %5, 1
br i1 %7, label %8, label %41
8: ; preds = %0
%9 = add nsw i64 %6, -1
%10 = add nsw i64 %6, -2
%11 = and i64 %9, 7
%12 = icmp ult i64 %10, 7
br i1 %12, label %29, label %13
13: ; preds = %8
%14 = and i64 %9, -8
br label %15
15: ; preds = %15, %13
%16 = phi i64 [ 1, %13 ], [ %26, %15 ]
%17 = phi i64 [ 0, %13 ], [ %25, %15 ]
%18 = phi i64 [ 0, %13 ], [ %27, %15 ]
%19 = add nuw nsw i64 %16, %17
%20 = add nuw nsw i64 %19, %16
%21 = add nuw nsw i64 %20, %19
%22 = add nuw nsw i64 %21, %20
%23 = add nuw nsw i64 %22, %21
%24 = add nuw nsw i64 %23, %22
%25 = add nuw nsw i64 %24, %23
%26 = add nuw nsw i64 %25, %24
%27 = add i64 %18, 8
%28 = icmp eq i64 %27, %14
br i1 %28, label %29, label %15
29: ; preds = %15, %8
%30 = phi i64 [ undef, %8 ], [ %25, %15 ]
%31 = phi i64 [ 1, %8 ], [ %26, %15 ]
%32 = phi i64 [ 0, %8 ], [ %25, %15 ]
%33 = icmp eq i64 %11, 0
br i1 %33, label %41, label %34
34: ; preds = %29, %34
%35 = phi i64 [ %38, %34 ], [ %31, %29 ]
%36 = phi i64 [ %35, %34 ], [ %32, %29 ]
%37 = phi i64 [ %39, %34 ], [ 0, %29 ]
%38 = add nuw nsw i64 %35, %36
%39 = add i64 %37, 1
%40 = icmp eq i64 %39, %11
br i1 %40, label %41, label %34
41: ; preds = %29, %34, %0
%42 = phi i64 [ 0, %0 ], [ %30, %29 ], [ %35, %34 ]
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i64 %42)
ret i32 0
}