#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 main() {
  int n = 0;
  int i = 0;
  int num1, num2, num3;
  while ((n < 1) || (n > 9)) {
    printf("Please enter an integer between 1 and 9: ");
    scanf("%d", &n);
  }
  while (i < 50) {
    if (i < 2) {
      printf("%d ", n);
      printf("%d ", n);
      num1 = n;
      num2 = n;
      i = 2;
    } else {
      num3 = num1 + num2;
      if (num3 < 10) {
        num1 = num2;
        num2 = num3;
        printf("%d ", num2);
      } else {
        num1 = num2;
        num2 = (num3 % 10) + 1;
        printf("%d ", num2);
      }
    }
    i += 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x15(%rbp)
jl     114f <main+0x2f>
cmpl   $0x9,-0x4(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115f <main+0x3f>
jmp    1182 <main+0x62>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1136 <main+0x16>
jmp    1187 <main+0x67>
cmpl   $0x32,-0x8(%rbp)
jge    1245 <main+0x125>
cmpl   $0x2,-0x8(%rbp)
jge    11d5 <main+0xb5>
mov    -0x4(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
jmp    1237 <main+0x117>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    120a <main+0xea>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1237 <main+0x117>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1187 <main+0x67>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xec5(%rip),%r14
lea    0xee8(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xfffffff6,%eax
cmp    $0xfffffff7,%eax
jb     1150 <main+0x30>
lea    0xeb5(%rip),%r14
mov    $0xcccccccd,%r15d
xor    %r12d,%r12d
jmp    11cc <main+0xac>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xc(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%r12d
mov    0xc(%rsp),%ebp
mov    %ebp,%ebx
mov    %ebp,%eax
lea    0x1(%r12),%ecx
mov    %ebx,%ebp
mov    %eax,%ebx
cmp    $0x31,%r12d
mov    %ecx,%r12d
jae    11fd <main+0xdd>
cmp    $0x1,%r12d
jle    1190 <main+0x70>
add    %ebp,%ebx
cmp    $0x9,%ebx
jle    11ef <main+0xcf>
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
neg    %eax
add    %eax,%ebx
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b8 <main+0x98>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Please enter an integer between 1 and 9: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 9
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %6
17: ; preds = %12
br label %18
18: ; preds = %50, %17
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 50
br i1 %20, label %21, label %53
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 2
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load i32, i32* %1
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
store i32 %29, i32* %3
%30 = load i32, i32* %1
store i32 %30, i32* %4
store i32 2, i32* %2
br label %50
31: ; preds = %21
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = add nsw i32 %32, %33
store i32 %34, i32* %5
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %42
37: ; preds = %31
%38 = load i32, i32* %4
store i32 %38, i32* %3
%39 = load i32, i32* %5
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %49
42: ; preds = %31
%43 = load i32, i32* %4
store i32 %43, i32* %3
%44 = load i32, i32* %5
%45 = srem i32 %44, 10
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
%47 = load i32, i32* %4
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %42, %37
br label %50
50: ; preds = %49, %24
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %18
53: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Please enter an integer between 1 and 9: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 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), i32* %1)
%6 = load i32, i32* %1
%7 = add i32 %6, -10
%8 = icmp ult i32 %7, -9
br i1 %8, label %3, label %9
9: ; preds = %3, %29
%10 = phi i32 [ %33, %29 ], [ 0, %3 ]
%11 = phi i32 [ %31, %29 ], [ undef, %3 ]
%12 = phi i32 [ %30, %29 ], [ undef, %3 ]
%13 = icmp slt i32 %10, 2
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %1
br label %29
20: ; preds = %9
%21 = add nsw i32 %11, %12
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %29
25: ; preds = %20
%26 = urem i32 %21, 10
%27 = add nuw nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %23, %25, %14
%30 = phi i32 [ %19, %14 ], [ %11, %23 ], [ %11, %25 ]
%31 = phi i32 [ %19, %14 ], [ %21, %23 ], [ %27, %25 ]
%32 = phi i32 [ 2, %14 ], [ %10, %23 ], [ %10, %25 ]
%33 = add nuw nsw i32 %32, 1
%34 = icmp ult i32 %32, 49
br i1 %34, label %9, label %35
35: ; preds = %29
ret void
}