#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 */
scalar_t__ EOF;
int /*<<< orphan*/ imprimirSequencia(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
scalar_t__ tamanhoDaSequencia(int);
int main(void) {
  int numero, i, caso = 1, tamanhoTotalDaSequencia;
  while (scanf("%d\n", &numero) != EOF) {
    tamanhoTotalDaSequencia = 0;
    for (i = 0; i <= numero; i++) {
      tamanhoTotalDaSequencia += tamanhoDaSequencia(i);
    }
    printf("Caso %d: %d %s\n", caso++, tamanhoTotalDaSequencia,
           tamanhoTotalDaSequencia == 1 ? "numero" : "numeros");
    for (i = 0; i <= numero; i++) {
      imprimirSequencia(i);
      if (i < numero) {
        printf(" ");
      } else {
        printf("\n");
      }
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%rax
je     1255 <main+0x115>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b3 <main+0x73>
mov    -0xc(%rbp),%edi
call   1050 <tamanhoDaSequencia@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1184 <main+0x44>
mov    -0x10(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%edi
lea    0xe50(%rip),%rcx
lea    0xe42(%rip),%rax
cmp    $0x1,%edi
cmove  %rax,%rcx
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1242 <main+0x102>
mov    -0xc(%rbp),%edi
call   1030 <imprimirSequencia@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1221 <main+0xe1>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122f <main+0xef>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1234 <main+0xf4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ee <main+0xae>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe9e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%rax
jne    1189 <main+0x39>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r13d
lea    0xe85(%rip),%r14
lea    0x4(%rsp),%r12
mov    $0x20,%r15d
jmp    11d9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13d
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe3b(%rip),%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
mov    0x2e14(%rip),%rcx
cmp    (%rcx),%rax
je     1178 <main+0x28>
cmpl   $0x0,0x4(%rsp)
mov    $0x0,%ebp
mov    %r14,%rcx
js     1213 <main+0xc3>
xor    %ebp,%ebp
mov    $0xffffffff,%ebx
nop
add    $0x1,%ebx
mov    %ebx,%edi
call   1060 <tamanhoDaSequencia@plt>
add    %eax,%ebp
cmp    0x4(%rsp),%ebx
jl     11f0 <main+0xa0>
cmp    $0x1,%ebp
mov    %r14,%rcx
lea    0xe05(%rip),%rax
cmove  %rax,%rcx
lea    0xdea(%rip),%rdi
mov    %r13d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x4(%rsp)
js     11b0 <main+0x60>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <imprimirSequencia@plt>
cmp    0x4(%rsp),%ebx
mov    $0xa,%edi
cmovl  %r15d,%edi
call   1030 <putchar@plt>
cmp    0x4(%rsp),%ebx
jl     1240 <main+0xf0>
jmp    11b0 <main+0x60>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
@.str.1 = [16 x i8] c"Caso %d: %d %s\0A\00"
@.str.2 = [7 x i8] c"numero\00"
@.str.3 = [8 x i8] c"numeros\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
br label %6
6: ; preds = %52, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %54
10: ; preds = %6
store i32 0, i32* %5
store i32 0, i32* %3
br label %11
11: ; preds = %22, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i32, i32* %3
%17 = call i64 @tamanhoDaSequencia(i32 %16)
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = add nsw i64 %19, %17
%21 = trunc i64 %20 to i32
store i32 %21, i32* %5
br label %22
22: ; preds = %15
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %11
25: ; preds = %11
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
%28 = load i32, i32* %5
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 1
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %28, i8* %32)
store i32 0, i32* %3
br label %34
34: ; preds = %49, %25
%35 = load i32, i32* %3
%36 = load i32, i32* %2
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %52
38: ; preds = %34
%39 = load i32, i32* %3
%40 = call i32 @imprimirSequencia(i32 %39)
%41 = load i32, i32* %3
%42 = load i32, i32* %2
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %48
46: ; preds = %38
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %34
52: ; preds = %34
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %6
54: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
@.str.1 = [16 x i8] c"Caso %d: %d %s\0A\00"
@.str.2 = [7 x i8] c"numero\00"
@.str.3 = [8 x i8] c"numeros\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %44, label %6
6: ; preds = %0, %39
%7 = phi i32 [ %25, %39 ], [ 1, %0 ]
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %6, %10
%11 = phi i32 [ %15, %10 ], [ 0, %6 ]
%12 = phi i32 [ %16, %10 ], [ 0, %6 ]
%13 = call i64 @tamanhoDaSequencia(i32 %12)
%14 = trunc i64 %13 to i32
%15 = add i32 %11, %14
%16 = add nuw nsw i32 %12, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %12, %17
br i1 %18, label %10, label %19
19: ; preds = %10
%20 = icmp eq i32 %15, 1
%21 = select i1 %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
br label %22
22: ; preds = %6, %19
%23 = phi i32 [ %15, %19 ], [ 0, %6 ]
%24 = phi i8* [ %21, %19 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %6 ]
%25 = add nuw nsw i32 %7, 1
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %23, i8* %24)
%27 = load i32, i32* %1
%28 = icmp slt i32 %27, 0
br i1 %28, label %39, label %29
29: ; preds = %22, %29
%30 = phi i32 [ %36, %29 ], [ 0, %22 ]
%31 = call i32 @imprimirSequencia(i32 %30)
%32 = load i32, i32* %1
%33 = icmp slt i32 %30, %32
%34 = select i1 %33, i32 32, i32 10
%35 = call i32 @putchar(i32 %34)
%36 = add nuw nsw i32 %30, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %30, %37
br i1 %38, label %29, label %39
39: ; preds = %29, %22
%40 = call i32 @putchar(i32 10)
%41 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%42 = load i64, i64* @EOF
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %6
44: ; preds = %39, %0
ret i32 0
}