#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 *, unsigned char *);
int main() {
  unsigned char n;
  int i;
  printf("Please enter n:");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movzbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jg     1182 <main+0x62>
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
cmpb   $0x0,0x7(%rsp)
je     1178 <main+0x58>
lea    0xec3(%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>
movzbl 0x7(%rsp),%eax
cmp    %eax,%ebp
jb     1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Please enter n:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
store i32 1, i32* %3
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %3
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = icmp sle i32 %7, %9
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Please enter n:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ 1, %0 ]
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = add nuw nsw i32 %7, 1
%10 = load i8, i8* %1
%11 = zext i8 %10 to i32
%12 = icmp ult i32 %7, %11
br i1 %12, label %6, label %13
13: ; preds = %6, %0
ret i32 0
}