#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 *);
void contador(void) {
  int count = 1;
  int stop;
  printf("Hasta donde guste que cuente? ");
  scanf("%d", &stop);
  for (count = 1; count <= stop; count++)
    printf("%d\n", count);
}


x86 assembly (clang, -O0):
<contador>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     117f <contador+0x5f>
mov    -0x4(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <contador+0x34>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contador>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1175 <contador+0x55>
lea    0xed2(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0x4(%rsp),%ebp
jl     1160 <contador+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Hasta donde guste que cuente? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @contador() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 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* %2)
store i32 1, i32* %1
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %5
15: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Hasta donde guste que cuente? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @contador() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 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 = icmp slt i32 %5, 1
br i1 %6, label %13, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %10, %7 ], [ 1, %0 ]
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i32 %8, 1
%11 = load i32, i32* %1
%12 = icmp slt i32 %8, %11
br i1 %12, label %7, label %13
13: ; preds = %7, %0
ret void
}