#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 *, long);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  long int n, prod = 1;
  scanf("%ld", &n);
  while (n != 0) {
    prod *= n % 10;
    n /= 10;
  }
  printf("%ld", prod);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x18(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1180 <main+0x60>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
imul   -0x18(%rbp),%rdx
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
jmp    1147 <main+0x27>
mov    -0x18(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rdx
mov    $0x1,%esi
test   %rdx,%rdx
je     1187 <main+0x67>
movabs $0x6666666666666667,%r8
66 66 66
nopl   0x0(%rax,%rax,1)
mov    %rdx,%rdi
mov    %rdx,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rdi,%rcx
sub    %rax,%rcx
imul   %rcx,%rsi
add    $0x9,%rdi
cmp    $0x12,%rdi
ja     1150 <main+0x30>
mov    %rdx,(%rsp)
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = icmp eq i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %0, %6
%7 = phi i64 [ %10, %6 ], [ 1, %0 ]
%8 = phi i64 [ %11, %6 ], [ %4, %0 ]
%9 = srem i64 %8, 10
%10 = mul nsw i64 %7, %9
%11 = sdiv i64 %8, 10
%12 = add i64 %8, 9
%13 = icmp ult i64 %12, 19
br i1 %13, label %14, label %6
14: ; preds = %6
store i64 %11, i64* %1
br label %15
15: ; preds = %14, %0
%16 = phi i64 [ %10, %14 ], [ 1, %0 ]
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %16)
ret i32 0
}