#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numero, mult, clone;
  printf("Vamos brincar com os numeros!\nMe diga um numero NATURAL que eu irei "
         "lhe dizer\nqual a multiplicacao de todos os seus numeros\nEx: Se "
         "voce me dar 123, eu te darei 6, pois 6 = 1 x 2 x 3\n");
  scanf("%d", &numero);
  clone = numero;
  mult = 1;
  while ((clone) != 0) {
    if ((clone % 10) == 0) {
      mult = mult;
      clone = clone / 10;
    } else {
      mult = mult * (clone % 10);
      clone = clone / 10;
    }
  }
  printf("O numero dado e o: %d\nO multiplo de seus digitos e: %d", numero,
         mult);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf97(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11ce <main+0x9e>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a1 <main+0x71>
mov    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    11c9 <main+0x99>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
imul   %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    116a <main+0x3a>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     11b4 <main+0x74>
mov    $0x1,%r8d
mov    %esi,%ecx
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ecx,%rdi
imul   $0x66666667,%rdi,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x22,%rcx
add    %eax,%ecx
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rax,4),%r9d
mov    %edi,%eax
sub    %r9d,%eax
cmove  %r8d,%eax
imul   %eax,%edx
add    $0x9,%edi
cmp    $0x12,%edi
ja     1180 <main+0x40>
jmp    11b9 <main+0x79>
mov    $0x1,%edx
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [183 x i8] c"Vamos brincar com os numeros!\0AMe diga um numero NATURAL que eu irei lhe dizer\0Aqual a multiplicacao de todos os seus numeros\0AEx: Se voce me dar 123, eu te darei 6, pois 6 = 1 x 2 x 3\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [55 x i8] c"O numero dado e o: %d\0AO multiplo de seus digitos e: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([183 x i8], [183 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)
%7 = load i32, i32* %2
store i32 %7, i32* %4
store i32 1, i32* %3
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %4
%13 = srem i32 %12, 10
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* %3
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = sdiv i32 %17, 10
store i32 %18, i32* %4
br label %26
19: ; preds = %11
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = srem i32 %21, 10
%23 = mul nsw i32 %20, %22
store i32 %23, i32* %3
%24 = load i32, i32* %4
%25 = sdiv i32 %24, 10
store i32 %25, i32* %4
br label %26
26: ; preds = %19, %15
br label %8
27: ; preds = %8
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29)
%31 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [55 x i8] c"O numero dado e o: %d\0AO multiplo de seus digitos e: %d\00"
@str = [182 x i8] c"Vamos brincar com os numeros!\0AMe diga um numero NATURAL que eu irei lhe dizer\0Aqual a multiplicacao de todos os seus numeros\0AEx: Se voce me dar 123, eu te darei 6, pois 6 = 1 x 2 x 3\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([182 x i8], [182 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 eq i32 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %14, %7 ], [ %5, %0 ]
%9 = phi i32 [ %13, %7 ], [ 1, %0 ]
%10 = srem i32 %8, 10
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 1, i32 %10
%13 = mul nsw i32 %12, %9
%14 = sdiv i32 %8, 10
%15 = add i32 %8, 9
%16 = icmp ult i32 %15, 19
br i1 %16, label %17, label %7
17: ; preds = %7, %0
%18 = phi i32 [ 1, %0 ], [ %13, %7 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %18)
%20 = call i32 (...) @getch()
ret i32 0
}