#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 */
typedef int int32_t;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, double *);
int main() {
  double n;
  int32_t d[] = {10000, 5000, 2000, 1000, 500, 200, 100, 50, 25, 10, 5, 1};
  int32_t total_value, t = 0, c, i;
  while (scanf("%lf", &n) != EOF) {
    total_value = (int32_t)(n * 100);
    printf("NOTAS:\n");
    t = 0;
    for (i = 0; i < 12; i++) {
      c = 0;
      while (total_value >= d[t]) {
        total_value -= d[t];
        c++;
      }
      if (d[t] == 100) {
        printf("MOEDAS:\n");
      }
      if (d[t] >= 200) {
        printf("%d nota(s) de R$ %d.00\n", c, d[t] / 100);
      } else {
        printf("%d moeda(s) de R$ %.2f\n", c, d[t] / 100.0);
      }
      t++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x48(%rbp)
lea    0xede(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%rax
je     1285 <main+0x155>
movsd  0xe7d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x44(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x50(%rbp)
cmpl   $0xc,-0x50(%rbp)
jge    1280 <main+0x150>
movl   $0x0,-0x4c(%rbp)
mov    -0x44(%rbp),%eax
movslq -0x48(%rbp),%rcx
cmp    -0x40(%rbp,%rcx,4),%eax
jl     11eb <main+0xbb>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
mov    -0x44(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11bc <main+0x8c>
movslq -0x48(%rbp),%rax
cmpl   $0x64,-0x40(%rbp,%rax,4)
jne    1208 <main+0xd8>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x48(%rbp),%rax
cmpl   $0xc8,-0x40(%rbp,%rax,4)
jl     1242 <main+0x112>
mov    -0x4c(%rbp),%esi
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1269 <main+0x139>
mov    -0x4c(%rbp),%esi
movslq -0x48(%rbp),%rax
cvtsi2sdl -0x40(%rbp,%rax,4),%xmm0
movsd  0xda9(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe0b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11ab <main+0x7b>
jmp    115b <main+0x2b>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xefe(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    0x2e97(%rip),%rcx
cmp    (%rcx),%rax
jne    1167 <main+0x37>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea2(%rip),%r12
lea    0xee7(%rip),%rbx
jmp    119b <main+0x6b>
nopw   0x0(%rax,%rax,1)
lea    0xeb9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%rax
je     1156 <main+0x26>
movsd  (%rsp),%xmm0
mulsd  0xe58(%rip),%xmm0
cvttsd2si %xmm0,%r13d
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
jmp    11f3 <main+0xc3>
nopl   (%rax)
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
divsd  0xe24(%rip),%xmm0
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    $0xc,%rbp
je     1180 <main+0x50>
mov    (%r12,%rbp,4),%r15d
xor    %r14d,%r14d
cmp    %r15d,%r13d
jl     121c <main+0xec>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    %r15d,%r13d
add    $0x1,%r14d
cmp    %r15d,%r13d
jge    1210 <main+0xe0>
cmp    $0x6,%rbp
je     11c0 <main+0x90>
jae    11cc <main+0x9c>
movslq %r15d,%rax
imul   $0x51eb851f,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x25,%rdx
add    %eax,%edx
lea    0xe02(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11e9 <main+0xb9>

LLVM IR (-O0):
@__const.main.d = [12 x i32] [i32 10000, i32 5000, i32 2000, i32 1000, i32 500, i32 200, i32 100, i32 50, i32 25, i32 10, i32 5, i32 1]
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [8 x i8] c"NOTAS:\0A\00"
@.str.2 = [9 x i8] c"MOEDAS:\0A\00"
@.str.3 = [24 x i8] c"%d nota(s) de R$ %d.00\0A\00"
@.str.4 = [24 x i8] c"%d moeda(s) de R$ %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca [12 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [12 x i32]* %3 to i8*
store i32 0, i32* %5
br label %9
9: ; preds = %75, %0
%10 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %76
13: ; preds = %9
%14 = load double, double* %2
%15 = fmul double %14, 1.000000e+02
%16 = fptosi double %15 to i32
store i32 %16, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
store i32 0, i32* %7
br label %18
18: ; preds = %72, %13
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 12
br i1 %20, label %21, label %75
21: ; preds = %18
store i32 0, i32* %6
br label %22
22: ; preds = %29, %21
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp sge i32 %23, %27
br i1 %28, label %29, label %38
29: ; preds = %22
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %4
%35 = sub nsw i32 %34, %33
store i32 %35, i32* %4
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %22
38: ; preds = %22
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 100
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %38
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = icmp sge i32 %50, 200
br i1 %51, label %52, label %60
52: ; preds = %46
%53 = load i32, i32* %6
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = sdiv i32 %57, 100
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %53, i32 %58)
br label %69
60: ; preds = %46
%61 = load i32, i32* %6
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = sitofp i32 %65 to double
%67 = fdiv double %66, 1.000000e+02
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %61, double %67)
br label %69
69: ; preds = %60, %52
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 1
store i32 %71, i32* %5
br label %72
72: ; preds = %69
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
br label %18
75: ; preds = %18
br label %9
76: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@__const.main.d = [12 x i32] [i32 10000, i32 5000, i32 2000, i32 1000, i32 500, i32 200, i32 100, i32 50, i32 25, i32 10, i32 5, i32 1]
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.3 = [24 x i8] c"%d nota(s) de R$ %d.00\0A\00"
@.str.4 = [24 x i8] c"%d moeda(s) de R$ %.2f\0A\00"
@str = [7 x i8] c"NOTAS:\00"
@str.5 = [8 x i8] c"MOEDAS:\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %45, label %10
6: ; preds = %42
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %45, label %10
10: ; preds = %0, %6
%11 = load double, double* %1
%12 = fmul double %11, 1.000000e+02
%13 = fptosi double %12 to i32
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %10, %42
%16 = phi i64 [ 0, %10 ], [ %43, %42 ]
%17 = phi i32 [ %13, %10 ], [ %28, %42 ]
%18 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.main.d, i64 0, i64 %16
%19 = load i32, i32* %18
%20 = icmp slt i32 %17, %19
br i1 %20, label %27, label %21
21: ; preds = %15, %21
%22 = phi i32 [ %25, %21 ], [ 0, %15 ]
%23 = phi i32 [ %24, %21 ], [ %17, %15 ]
%24 = sub nsw i32 %23, %19
%25 = add nuw nsw i32 %22, 1
%26 = icmp slt i32 %24, %19
br i1 %26, label %27, label %21
27: ; preds = %21, %15
%28 = phi i32 [ %17, %15 ], [ %24, %21 ]
%29 = phi i32 [ 0, %15 ], [ %25, %21 ]
%30 = icmp eq i64 %16, 6
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
br label %38
33: ; preds = %27
%34 = icmp ult i64 %16, 6
br i1 %34, label %35, label %38
35: ; preds = %33
%36 = sdiv i32 %19, 100
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %36)
br label %42
38: ; preds = %31, %33
%39 = sitofp i32 %19 to double
%40 = fdiv double %39, 1.000000e+02
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %29, double %40)
br label %42
42: ; preds = %38, %35
%43 = add nuw nsw i64 %16, 1
%44 = icmp eq i64 %43, 12
br i1 %44, label %6, label %15
45: ; preds = %6, %0
ret i32 0
}