#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 *);
int /*<<< orphan*/ system(char *);
int main() {
  int k = 0;
  int n = 0;
  int i = 0;
  int contador = 0;
  printf("\n\nVamos calcular a sequencia de Fitromacci. Entre com k depois "
         "n:\n\n");
  scanf("%d%d", &k, &n);
  if (k >= n && k > 0) {
    printf("K não pode ser maior ou igual a N");
    return 1;
  }
  int vetor[n];
  contador = k;
  for (i = 0; i < n; i++) {
    if (contador > 0) {
      vetor[i] = 1;
      contador--;
    } else {
    }
  }
  printf("\n\n");
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11a9 <main+0x79>
cmpl   $0x0,-0x8(%rbp)
jle    11a9 <main+0x79>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124e <main+0x11e>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1228 <main+0xf8>
cmpl   $0x0,-0x14(%rbp)
jle    1210 <main+0xe0>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1215 <main+0xe5>
jmp    1215 <main+0xe5>
jmp    121a <main+0xea>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11dd <main+0xad>
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
lea    0xe31(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1198 <main+0x58>
cmp    0x8(%rsp),%eax
jl     1198 <main+0x58>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%eax
jmp    11b8 <main+0x78>
mov    %rsp,%rbx
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7a(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
mov    %rbx,%rsp
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [68 x i8] c"\0A\0AVamos calcular a sequencia de Fitromacci. Entre com k depois n:\0A\0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [35 x i8] c"K n\C3\A3o pode ser maior ou igual a N\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sge i32 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %0
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %46
18: ; preds = %13, %0
%19 = load i32, i32* %3
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %6
%22 = alloca i32, i64 %20
store i64 %20, i64* %7
%23 = load i32, i32* %2
store i32 %23, i32* %5
store i32 0, i32* %4
br label %24
24: ; preds = %39, %18
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = load i32, i32* %5
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %28
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %22, i64 %33
store i32 1, i32* %34
%35 = load i32, i32* %5
%36 = add nsw i32 %35, -1
store i32 %36, i32* %5
br label %38
37: ; preds = %28
br label %38
38: ; preds = %37, %31
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %24
42: ; preds = %24
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
%45 = load i8*, i8** %6
br label %46
46: ; preds = %42, %16
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [35 x i8] c"K n\C3\A3o pode ser maior ou igual a N\00"
@.str.4 = [6 x i8] c"PAUSE\00"
@str = [67 x i8] c"\0A\0AVamos calcular a sequencia de Fitromacci. Entre com k depois n:\0A\00"
@str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = icmp sge i32 %7, %8
%10 = icmp sgt i32 %7, 0
%11 = and i1 %10, %9
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %18
14: ; preds = %0
%15 = call i8* @llvm.stacksave()
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%17 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %14, %12
%19 = phi i32 [ 1, %12 ], [ 0, %14 ]
ret i32 %19
}