#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() {
  int totalFUP = 1, totalREAL = 1, resto, soma = 0;
  int n;
  printf("Digite um numero");
  scanf("%d", &n);
  while (n != 0) {
    resto = n % 10;
    if (resto % 3 == 0) {
      totalFUP = totalFUP * 3;
    } else {
      totalFUP = totalFUP * 1;
    }
    printf("%d", resto);
    n = n / 10;
  }
  printf("Total de FUP's: %d\n", totalFUP);
  printf("Sera depositado %d reais na sua conta\n", totalFUP * 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
je     11c7 <main+0xa7>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119a <main+0x7a>
imul   $0x3,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <main+0x83>
mov    -0x8(%rbp),%eax
shl    $0x0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
jmp    1162 <main+0x42>
mov    -0x8(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
je     11c0 <main+0xa0>
mov    $0x1,%eax
lea    0xebb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
movslq %ecx,%rsi
imul   $0x66666667,%rsi,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%esi
imul   $0xffffffab,%esi,%ecx
add    $0x2a,%cl
cmp    $0x55,%cl
lea    (%rax,%rax,2),%ebp
cmovae %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
mov    %ecx,0x4(%rsp)
lea    0x9(%rax),%edx
mov    %ebp,%eax
cmp    $0x12,%edx
ja     1160 <main+0x40>
jmp    11c5 <main+0xa5>
mov    $0x1,%ebp
lea    0xe48(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebp,%ebp
lea    0xe4a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Digite um numero\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Total de FUP's: %d\0A\00"
@.str.3 = [39 x i8] c"Sera depositado %d reais na sua conta\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
store i32 1, i32* %2
store i32 1, i32* %3
store i32 0, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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* %6)
br label %9
9: ; preds = %24, %0
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %6
%14 = srem i32 %13, 10
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = srem i32 %15, 3
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i32, i32* %2
%20 = mul nsw i32 %19, 3
store i32 %20, i32* %2
br label %24
21: ; preds = %12
%22 = load i32, i32* %2
%23 = mul nsw i32 %22, 1
store i32 %23, i32* %2
br label %24
24: ; preds = %21, %18
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %6
%28 = sdiv i32 %27, 10
store i32 %28, i32* %6
br label %9
29: ; preds = %9
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %2
%33 = mul nsw i32 %32, 2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [17 x i8] c"Digite um numero\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Total de FUP's: %d\0A\00"
@.str.3 = [39 x i8] c"Sera depositado %d reais na sua conta\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 %21, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %15, %7 ], [ 1, %0 ]
%9 = phi i32 [ %18, %7 ], [ %5, %0 ]
%10 = srem i32 %9, 10
%11 = trunc i32 %10 to i8
%12 = srem i8 %11, 3
%13 = icmp eq i8 %12, 0
%14 = mul nsw i32 %8, 3
%15 = select i1 %13, i32 %14, i32 %8
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%17 = load i32, i32* %1
%18 = sdiv i32 %17, 10
store i32 %18, i32* %1
%19 = add i32 %17, 9
%20 = icmp ult i32 %19, 19
br i1 %20, label %21, label %7
21: ; preds = %7, %0
%22 = phi i32 [ 1, %0 ], [ %15, %7 ]
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = shl nsw i32 %22, 1
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %24)
ret i32 0
}