#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 /*<<< orphan*/ system(char *);
main() {
  system("title 20_Cascallar_Autrán_Manuel");
  system("cls");
  printf("ESCRIBIR TODOS OS NUMEROS DESDE 1 ATA UN NUMERO INTRODUCIDO\n");
  printf("===========================================================\n");
  int a, x;
  printf("Introduce o n\243mero no que rematar\240 o bucle:\n");
  scanf("%d", &a);
  printf("\n");
  if (a >= 1) {
    for (x = 1; x <= a; x++) {
      printf("%d ", x);
    }
  } else
    printf(
        "O n\243mero escrito non \202 positivo, polo tanto non \202 valido\n");
  printf("\n");
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
lea    0xed0(%rip),%rdi
call   1030 <system@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf45(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     11e0 <main+0xb0>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11db <main+0xab>
mov    -0xc(%rbp),%esi
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <main+0x80>
jmp    11ee <main+0xbe>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0b(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xea6(%rip),%rdi
call   1050 <system@plt>
lea    0xebc(%rip),%rdi
call   1050 <system@plt>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
lea    0xef1(%rip),%rdi
call   1040 <puts@plt>
lea    0xf21(%rip),%rdi
call   1040 <puts@plt>
lea    0xe90(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    11d7 <main+0x87>
lea    0xe71(%rip),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    0x4(%rsp),%ebp
jl     11c0 <main+0x70>
jmp    11e3 <main+0x93>
lea    0xef9(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe39(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"title 20_Cascallar_Autr\C3\A1n_Manuel\00"
@.str.1 = [4 x i8] c"cls\00"
@.str.2 = [61 x i8] c"ESCRIBIR TODOS OS NUMEROS DESDE 1 ATA UN NUMERO INTRODUCIDO\0A\00"
@.str.3 = [61 x i8] c"===========================================================\0A\00"
@.str.4 = [45 x i8] c"Introduce o n\A3mero no que rematar\A0 o bucle:\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [4 x i8] c"%d \00"
@.str.8 = [58 x i8] c"O n\A3mero escrito non \82 positivo, polo tanto non \82 valido\0A\00"
@.str.9 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @system(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 1
br i1 %12, label %13, label %25
13: ; preds = %0
store i32 1, i32* %3
br label %14
14: ; preds = %21, %13
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %14
24: ; preds = %14
br label %27
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
br label %27
27: ; preds = %25, %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [34 x i8] c"title 20_Cascallar_Autr\C3\A1n_Manuel\00"
@.str.1 = [4 x i8] c"cls\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"%d \00"
@.str.9 = [6 x i8] c"pause\00"
@str = [60 x i8] c"ESCRIBIR TODOS OS NUMEROS DESDE 1 ATA UN NUMERO INTRODUCIDO\00"
@str.10 = [60 x i8] c"===========================================================\00"
@str.11 = [44 x i8] c"Introduce o n\A3mero no que rematar\A0 o bucle:\00"
@str.12 = [57 x i8] c"O n\A3mero escrito non \82 positivo, polo tanto non \82 valido\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @system(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.10, i64 0, i64 0))
%6 = bitcast i32* %1 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%9 = call i32 @putchar(i32 10)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %0, %12
%13 = phi i32 [ %15, %12 ], [ 1, %0 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i32 %13, 1
%16 = load i32, i32* %1
%17 = icmp slt i32 %13, %16
br i1 %17, label %12, label %20
18: ; preds = %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.12, i64 0, i64 0))
br label %20
20: ; preds = %12, %18
%21 = call i32 @putchar(i32 10)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}