#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 abs(int);
scalar_t__ pow(int, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int input, rem, absinput, adummy, bdummy, D, cdummy;
  printf("Enter an integer > ");
  scanf("%d", &input);
  adummy = 0;
  cdummy = 1;
  while (cdummy == 1) {
    bdummy = input % (int)(pow(10, ((float)adummy)));
    if (bdummy == input) {
      D = adummy;
      cdummy = 0;
    }
    adummy++;
  }
  adummy = 0;
  absinput = abs(input);
  while (adummy < (D - 1)) {
    rem = (absinput / ((int)(pow(10, ((float)adummy))))) % 10;
    printf("%d\n", rem);
    adummy++;
  }
  rem = (input / ((int)(pow(10, ((float)(D - 1)))))) % 10;
  printf("%d\n", rem);
  printf("That's all, have a nice day!\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jne    11cd <main+0x8d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
mov    $0xa,%edi
call   1060 <pow@plt>
mov    %rax,%rcx
mov    -0x24(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11bf <main+0x7f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117b <main+0x3b>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1238 <main+0xf8>
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
mov    $0xa,%edi
call   1060 <pow@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%eax
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11df <main+0x9f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    $0xa,%edi
call   1060 <pow@plt>
mov    %rax,%rcx
mov    -0x2c(%rbp),%eax
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xfffffffe,%r15d
mov    0x4(%rsp),%ebx
lea    0x2(%r15),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    $0xa,%edi
call   1060 <pow@plt>
mov    %rax,%rcx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    0x4(%rsp),%ebx
add    $0x1,%r15d
cmp    %ebx,%edx
jne    1170 <main+0x30>
mov    %edx,%ebp
mov    %edx,%ebx
neg    %ebx
cmovs  %edx,%ebx
lea    0x1(%r15),%eax
cmp    $0x2,%eax
jb     120d <main+0xcd>
lea    0xe65(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mov    $0xa,%edi
call   1060 <pow@plt>
mov    %rax,%rcx
mov    %ebx,%eax
cltd
idiv   %ecx
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    11c0 <main+0x80>
mov    0x4(%rsp),%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
mov    $0xa,%edi
call   1060 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
lea    0xdcb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
store i32 1, i32* %8
br label %11
11: ; preds = %26, %0
%12 = load i32, i32* %8
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %29
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %5
%17 = sitofp i32 %16 to float
%18 = call i64 @pow(i32 10, float %17)
%19 = trunc i64 %18 to i32
%20 = srem i32 %15, %19
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = load i32, i32* %2
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %14
%25 = load i32, i32* %5
store i32 %25, i32* %7
store i32 0, i32* %8
br label %26
26: ; preds = %24, %14
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %11
29: ; preds = %11
store i32 0, i32* %5
%30 = load i32, i32* %2
%31 = call i32 @abs(i32 %30)
store i32 %31, i32* %4
br label %32
32: ; preds = %37, %29
%33 = load i32, i32* %5
%34 = load i32, i32* %7
%35 = sub nsw i32 %34, 1
%36 = icmp slt i32 %33, %35
br i1 %36, label %37, label %49
37: ; preds = %32
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = sitofp i32 %39 to float
%41 = call i64 @pow(i32 10, float %40)
%42 = trunc i64 %41 to i32
%43 = sdiv i32 %38, %42
%44 = srem i32 %43, 10
store i32 %44, i32* %3
%45 = load i32, i32* %3
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %32
49: ; preds = %32
%50 = load i32, i32* %2
%51 = load i32, i32* %7
%52 = sub nsw i32 %51, 1
%53 = sitofp i32 %52 to float
%54 = call i64 @pow(i32 10, float %53)
%55 = trunc i64 %54 to i32
%56 = sdiv i32 %50, %55
%57 = srem i32 %56, 10
store i32 %57, i32* %3
%58 = load i32, i32* %3
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %58)
%60 = 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
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ %5, %0 ], [ %13, %6 ]
%8 = phi i32 [ 0, %0 ], [ %15, %6 ]
%9 = sitofp i32 %8 to float
%10 = call i64 @pow(i32 10, float %9)
%11 = trunc i64 %10 to i32
%12 = srem i32 %7, %11
%13 = load i32, i32* %1
%14 = icmp eq i32 %12, %13
%15 = add nuw nsw i32 %8, 1
br i1 %14, label %16, label %6
16: ; preds = %6
%17 = call i32 @llvm.abs.i32(i32 %12, i1 true)
%18 = add nsw i32 %8, -1
%19 = icmp ugt i32 %8, 1
br i1 %19, label %20, label %32
20: ; preds = %16, %20
%21 = phi i32 [ %28, %20 ], [ 0, %16 ]
%22 = sitofp i32 %21 to float
%23 = call i64 @pow(i32 10, float %22)
%24 = trunc i64 %23 to i32
%25 = sdiv i32 %17, %24
%26 = srem i32 %25, 10
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = add nuw nsw i32 %21, 1
%29 = icmp eq i32 %28, %18
br i1 %29, label %30, label %20
30: ; preds = %20
%31 = load i32, i32* %1
br label %32
32: ; preds = %30, %16
%33 = phi i32 [ %31, %30 ], [ %12, %16 ]
%34 = sitofp i32 %18 to float
%35 = call i64 @pow(i32 10, float %34)
%36 = trunc i64 %35 to i32
%37 = sdiv i32 %33, %36
%38 = srem i32 %37, 10
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret i32 0
}