#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 divizor(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, p = 1, nr = 0;
  printf("Insert: \n");
  scanf("%d", &n);
  while (n > 0) {
    nr = nr + p * divizor(n % 10);
    p = p * 10;
    n = n / 10;
  }
  printf("%d \n", nr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11bd <main+0x8d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <divizor@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    116b <main+0x3b>
mov    -0x10(%rbp),%esi
lea    0xe46(%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   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    11c5 <main+0x85>
mov    $0x1,%ebx
xor    %ebp,%ebp
mov    $0xcccccccd,%r14d
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1050 <divizor@plt>
imul   %ebx,%eax
add    %eax,%ebp
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
movslq 0xc(%rsp),%rax
imul   $0x66666667,%rax,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdi
add    %ecx,%edi
mov    %edi,0xc(%rsp)
cmp    $0x9,%rax
jg     1180 <main+0x40>
jmp    11c7 <main+0x87>
xor    %ebp,%ebp
lea    0xe35(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Insert: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %10, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = srem i32 %13, 10
%15 = call i32 @divizor(i32 %14)
%16 = mul nsw i32 %12, %15
%17 = add nsw i32 %11, %16
store i32 %17, i32* %4
%18 = load i32, i32* %3
%19 = mul nsw i32 %18, 10
store i32 %19, i32* %3
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10
store i32 %21, i32* %2
br label %7
22: ; preds = %7
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%d \0A\00"
@str = [9 x i8] c"Insert: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 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 %19
7: ; preds = %0, %7
%8 = phi i32 [ %14, %7 ], [ 0, %0 ]
%9 = phi i32 [ %15, %7 ], [ 1, %0 ]
%10 = phi i32 [ %17, %7 ], [ %5, %0 ]
%11 = urem i32 %10, 10
%12 = call i32 @divizor(i32 %11)
%13 = mul nsw i32 %12, %9
%14 = add nsw i32 %13, %8
%15 = mul nsw i32 %9, 10
%16 = load i32, i32* %1
%17 = sdiv i32 %16, 10
store i32 %17, i32* %1
%18 = icmp sgt i32 %16, 9
br i1 %18, label %7, label %19
19: ; preds = %7, %0
%20 = phi i32 [ 0, %0 ], [ %14, %7 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %20)
ret i32 0
}