#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 main() {
  int n, digit;
  printf("Enter an integer > ");
  scanf("%d", &n);
  if (n / 10000000000 < 1)
    while (n > 0) {
      digit = n % 10;
      printf("%d\n", digit);
      n = n / 10.0;
    }
  printf("That's all, have a nice day!\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
movabs $0x2540be400,%rcx
cqto
idiv   %rcx
cmp    $0x1,%rax
jge    11ba <main+0x9a>
jmp    116f <main+0x4f>
cmpl   $0x0,-0x8(%rbp)
jle    11b5 <main+0x95>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe5b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <main+0x4f>
jmp    11ba <main+0x9a>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11a8 <main+0x78>
mov    $0xcccccccd,%r14d
lea    0xeb7(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
divsd  0xe64(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %esi,0x4(%rsp)
test   %esi,%esi
jg     1170 <main+0x40>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [30 x i8] c"That's all, have a nice day!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 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* %2)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = sdiv i64 %7, 10000000000
%9 = icmp slt i64 %8, 1
br i1 %9, label %10, label %24
10: ; preds = %0
br label %11
11: ; preds = %14, %10
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, 1.000000e+01
%22 = fptosi double %21 to i32
store i32 %22, i32* %2
br label %11
23: ; preds = %11
br label %24
24: ; preds = %23, %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [29 x i8] c"That's all, have a nice day!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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 sgt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %0, %7
%8 = phi i32 [ %14, %7 ], [ %5, %0 ]
%9 = urem i32 %8, 10
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 1.000000e+01
%14 = fptosi double %13 to i32
store i32 %14, i32* %1
%15 = icmp sgt i32 %14, 0
br i1 %15, label %7, label %16
16: ; preds = %7, %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret i32 0
}