#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(void) {
  int n, input, digit, inter, lastdigit;
  printf("Enter an integer > ");
  scanf("%d", &input);
  lastdigit = 0;
  for (n = 10; n < 10000000001; n = n * 10) {
    digit = input % n;
    inter = digit;
    inter = inter - lastdigit;
    if (input < 0 && !(input == digit))
      printf("%d\n", -inter * 10 / n);
    if (input < 0 && input == digit)
      printf("%d\n", inter * 10 / n);
    if (input > 0)
      printf("%d\n", inter * 10 / n);
    if (input == digit)
      break;
    lastdigit = digit;
  }
  printf("That's all, have a nice day!\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
movl   $0xa,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movabs $0x2540be401,%rcx
cmp    %rcx,%rax
jge    1230 <main+0x110>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11bd <main+0x9d>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11bd <main+0x9d>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
imul   $0xa,%eax,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jge    11eb <main+0xcb>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11eb <main+0xcb>
imul   $0xa,-0x14(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    120d <main+0xed>
imul   $0xa,-0x14(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    121e <main+0xfe>
jmp    1230 <main+0x110>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x3b>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xa,%ebx
mov    0x4(%rsp),%ecx
lea    0xeb1(%rip),%r14
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
cltd
idiv   %ebx
mov    %edx,%r15d
mov    %edx,%ebp
sub    %esi,%ebp
test   %ecx,%ecx
jns    11a1 <main+0x71>
cmp    %r15d,%ecx
je     11a1 <main+0x71>
lea    0x0(%rbp,%rbp,1),%eax
lea    (%rax,%rax,4),%eax
neg    %eax
cltd
idiv   %ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jns    11c4 <main+0x94>
cmp    %r15d,%ecx
jne    11c4 <main+0x94>
lea    0x0(%rbp,%rbp,1),%eax
lea    (%rax,%rax,4),%eax
cltd
idiv   %ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    11e1 <main+0xb1>
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
cltd
idiv   %ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ecx
cmp    %r15d,%ecx
je     11f0 <main+0xc0>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %r15d,%esi
jmp    1170 <main+0x40>
lea    0xe24(%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
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 0, i32* %6
store i32 10, i32* %2
br label %9
9: ; preds = %63, %0
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %11, 10000000001
br i1 %12, label %13, label %66
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = srem i32 %14, %15
store i32 %16, i32* %4
%17 = load i32, i32* %4
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %5
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %13
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = icmp eq i32 %24, %25
br i1 %26, label %34, label %27
27: ; preds = %23
%28 = load i32, i32* %5
%29 = sub nsw i32 0, %28
%30 = mul nsw i32 %29, 10
%31 = load i32, i32* %2
%32 = sdiv i32 %30, %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %27, %23, %13
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %47
41: ; preds = %37
%42 = load i32, i32* %5
%43 = mul nsw i32 %42, 10
%44 = load i32, i32* %2
%45 = sdiv i32 %43, %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %41, %37, %34
%48 = load i32, i32* %3
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %56
50: ; preds = %47
%51 = load i32, i32* %5
%52 = mul nsw i32 %51, 10
%53 = load i32, i32* %2
%54 = sdiv i32 %52, %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %50, %47
%57 = load i32, i32* %3
%58 = load i32, i32* %4
%59 = icmp eq i32 %57, %58
br i1 %59, label %60, label %61
60: ; preds = %56
br label %66
61: ; preds = %56
%62 = load i32, i32* %4
store i32 %62, i32* %6
br label %63
63: ; preds = %61
%64 = load i32, i32* %2
%65 = mul nsw i32 %64, 10
store i32 %65, i32* %2
br label %9
66: ; preds = %60, %9
%67 = 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 = %41, %0
%7 = phi i32 [ %5, %0 ], [ %39, %41 ]
%8 = phi i32 [ 10, %0 ], [ %42, %41 ]
%9 = phi i32 [ 0, %0 ], [ %10, %41 ]
%10 = srem i32 %7, %8
%11 = sub nsw i32 %10, %9
%12 = icmp sgt i32 %7, -1
%13 = icmp eq i32 %7, %10
%14 = select i1 %12, i1 true, i1 %13
br i1 %14, label %20, label %15
15: ; preds = %6
%16 = mul i32 %11, -10
%17 = sdiv i32 %16, %8
%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 %20
20: ; preds = %15, %6
%21 = phi i32 [ %19, %15 ], [ %7, %6 ]
%22 = icmp slt i32 %21, 0
%23 = icmp eq i32 %21, %10
%24 = select i1 %22, i1 %23, i1 false
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = mul nsw i32 %11, 10
%27 = sdiv i32 %26, %8
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
br label %30
30: ; preds = %25, %20
%31 = phi i32 [ %29, %25 ], [ %21, %20 ]
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = mul nsw i32 %11, 10
%35 = sdiv i32 %34, %8
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
br label %38
38: ; preds = %33, %30
%39 = phi i32 [ %37, %33 ], [ %31, %30 ]
%40 = icmp eq i32 %39, %10
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = mul nsw i32 %8, 10
br label %6
43: ; preds = %38
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret i32 0
}