#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 num;
  int dig1, dig2, dig3, dig4, dig5;
  printf("Digite um número de 5 digitos:\n");
  scanf("%d", &num);
  dig1 = num / 10000;
  dig2 = num / 1000 - dig1 * 10;
  dig3 = num / 100 - dig1 * 100 - dig2 * 10;
  dig4 = num / 10 - dig1 * 1000 - dig2 * 100 - dig3 * 10;
  dig5 = num / 1 - dig1 * 10000 - dig2 * 1000 - dig3 * 100 - dig4 * 10;
  printf("%d   %d   %d   %d   %d\n", dig1, dig2, dig3, dig4, dig5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0xa,-0x8(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   $0x64,-0x8(%rbp),%ecx
sub    %ecx,%eax
imul   $0xa,-0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
imul   $0x3e8,-0x8(%rbp),%ecx
sub    %ecx,%eax
imul   $0x64,-0xc(%rbp),%ecx
sub    %ecx,%eax
imul   $0xa,-0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
imul   $0x2710,-0x8(%rbp),%ecx
sub    %ecx,%eax
imul   $0x3e8,-0xc(%rbp),%ecx
sub    %ecx,%eax
imul   $0x64,-0x10(%rbp),%ecx
sub    %ecx,%eax
imul   $0xa,-0x14(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%r9
imul   $0x68db8bad,%r9,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rsi
add    %ecx,%esi
imul   $0x10624dd3,%r9,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rdx
add    %ecx,%edx
lea    (%rsi,%rsi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edx
imul   $0x51eb851f,%r9,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rdi
add    %ecx,%edi
imul   $0xffffff9c,%esi,%ecx
add    %edi,%ecx
lea    (%rdx,%rdx,1),%edi
lea    (%rdi,%rdi,4),%edi
sub    %edi,%ecx
imul   $0x66666667,%r9,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
imul   $0xfffffc18,%esi,%eax
add    %edi,%eax
imul   $0xffffff9c,%edx,%r8d
add    %eax,%r8d
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r8d
imul   $0xffffd8f0,%esi,%eax
add    %r9d,%eax
imul   $0xfffffc18,%edx,%edi
add    %eax,%edi
imul   $0xffffff9c,%ecx,%r9d
add    %edi,%r9d
lea    (%r8,%r8,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r9d
lea    0xe0a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Digite um n\C3\BAmero de 5 digitos:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"%d %d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 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* %1)
%9 = load i32, i32* %1
%10 = sdiv i32 %9, 10000
store i32 %10, i32* %2
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 1000
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, 10
%15 = sub nsw i32 %12, %14
store i32 %15, i32* %3
%16 = load i32, i32* %1
%17 = sdiv i32 %16, 100
%18 = load i32, i32* %2
%19 = mul nsw i32 %18, 100
%20 = sub nsw i32 %17, %19
%21 = load i32, i32* %3
%22 = mul nsw i32 %21, 10
%23 = sub nsw i32 %20, %22
store i32 %23, i32* %4
%24 = load i32, i32* %1
%25 = sdiv i32 %24, 10
%26 = load i32, i32* %2
%27 = mul nsw i32 %26, 1000
%28 = sub nsw i32 %25, %27
%29 = load i32, i32* %3
%30 = mul nsw i32 %29, 100
%31 = sub nsw i32 %28, %30
%32 = load i32, i32* %4
%33 = mul nsw i32 %32, 10
%34 = sub nsw i32 %31, %33
store i32 %34, i32* %5
%35 = load i32, i32* %1
%36 = sdiv i32 %35, 1
%37 = load i32, i32* %2
%38 = mul nsw i32 %37, 10000
%39 = sub nsw i32 %36, %38
%40 = load i32, i32* %3
%41 = mul nsw i32 %40, 1000
%42 = sub nsw i32 %39, %41
%43 = load i32, i32* %4
%44 = mul nsw i32 %43, 100
%45 = sub nsw i32 %42, %44
%46 = load i32, i32* %5
%47 = mul nsw i32 %46, 10
%48 = sub nsw i32 %45, %47
store i32 %48, i32* %6
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = load i32, i32* %5
%53 = load i32, i32* %6
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %49, i32 %50, i32 %51, i32 %52, i32 %53)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"%d %d %d %d %d\0A\00"
@str = [32 x i8] c"Digite um n\C3\BAmero de 5 digitos:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 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 = sdiv i32 %5, 10000
%7 = sdiv i32 %5, 1000
%8 = mul nsw i32 %6, -10
%9 = add nsw i32 %8, %7
%10 = sdiv i32 %5, 100
%11 = mul nsw i32 %6, -100
%12 = add nsw i32 %11, %10
%13 = mul nsw i32 %9, -10
%14 = add nsw i32 %12, %13
%15 = sdiv i32 %5, 10
%16 = mul nsw i32 %6, -1000
%17 = add nsw i32 %16, %15
%18 = mul nsw i32 %9, -100
%19 = add nsw i32 %17, %18
%20 = mul nsw i32 %14, -10
%21 = add nsw i32 %19, %20
%22 = mul nsw i32 %6, -10000
%23 = add i32 %22, %5
%24 = mul i32 %9, -1000
%25 = add i32 %23, %24
%26 = mul i32 %14, -100
%27 = add i32 %25, %26
%28 = mul i32 %21, -10
%29 = add i32 %27, %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %9, i32 %14, i32 %21, i32 %29)
ret i32 0
}