#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 /*<<< orphan*/ notes;

/* Variables and functions */
double floor(double);
double fmod(double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(int argc, char const *argv[]) {
  double notes[] = {100.00, 50.00, 20.00, 10.00, 5.00, 2.00,
                    1.00,   0.50,  0.25,  0.10,  0.05, 0.01};
  double monetary_value;
  scanf("%lf", &monetary_value);
  int i;
  for (i = 0; i < (sizeof(notes) / sizeof(double)); ++i) {
    double note_or_coin = notes[i];
    double note_or_coins_count = monetary_value / note_or_coin;
    monetary_value = fmod(monetary_value, note_or_coin);
    if (note_or_coin == 100.00) {
      printf("NOTAS:\n");
    } else if (note_or_coin == 1.00) {
      printf("MOEDAS:\n");
    }
    note_or_coins_count += 1e-9;
    printf("%.0f %s(s) de R$ %.2f\n", floor(note_or_coins_count),
           (note_or_coin >= 2.00) ? "nota" : "moeda", note_or_coin);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x60,%edx
call   1050 <memcpy@plt>
lea    0xefb(%rip),%rdi
lea    -0x78(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x7c(%rbp)
movslq -0x7c(%rbp),%rax
cmp    $0xc,%rax
jae    12b6 <main+0x166>
movslq -0x7c(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
call   1040 <fmod@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xe0f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1214 <main+0xc4>
jp     1214 <main+0xc4>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1247 <main+0xf7>
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xde4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1242 <main+0xf2>
jp     1242 <main+0xf2>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1247 <main+0xf7>
movsd  0xdc9(%rip),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1070 <floor@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  0xd94(%rip),%xmm2
lea    0xe2e(%rip),%rsi
lea    0xe22(%rip),%rax
ucomisd %xmm2,%xmm1
cmovae %rax,%rsi
movsd  -0x88(%rbp),%xmm1
ff
lea    0xdf4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1195 <main+0x45>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf0b(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xe9a(%rip),%r15
xor    %ebx,%ebx
lea    0xf1f(%rip),%r12
lea    0xf05(%rip),%r13
lea    0xf03(%rip),%rbp
lea    0xee0(%rip),%r14
jmp    11e5 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
call   1030 <puts@plt>
movsd  0x10(%rsp),%xmm0
divsd  (%rsp),%xmm0
addsd  0xe48(%rip),%xmm0
call   1070 <floor@plt>
cmp    $0x6,%rbx
mov    %rbp,%rsi
cmovb  %r13,%rsi
mov    %r14,%rdi
movsd  (%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x1,%rbx
add    $0x8,%r15
cmp    $0xc,%rbx
je     121b <main+0xcb>
movsd  (%r15),%xmm1
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,(%rsp)
call   1050 <fmod@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r12,%rdi
test   %ebx,%ebx
je     11a0 <main+0x50>
cmp    $0x6,%ebx
jne    11a5 <main+0x55>
lea    0xe7d(%rip),%rdi
jmp    11a0 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.notes = [12 x double] [double 1.000000e+02, double 5.000000e+01, double 2.000000e+01, double 1.000000e+01, double 5.000000e+00, double 2.000000e+00, double 1.000000e+00, double 5.000000e-01, double 2.500000e-01, double 1.000000e-01, double 5.000000e-02, double 1.000000e-02]
@.str = [4 x i8] c"%lf\00"
@.str.1 = [8 x i8] c"NOTAS:\0A\00"
@.str.2 = [9 x i8] c"MOEDAS:\0A\00"
@.str.3 = [23 x i8] c"%.0f %s(s) de R$ %.2f\0A\00"
@.str.4 = [5 x i8] c"nota\00"
@.str.5 = [6 x i8] c"moeda\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [12 x double]
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [12 x double]* %6 to i8*
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
store i32 0, i32* %8
br label %13
13: ; preds = %49, %2
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = icmp ult i64 %15, 12
br i1 %16, label %17, label %52
17: ; preds = %13
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [12 x double], [12 x double]* %6, i64 0, i64 %19
%21 = load double, double* %20
store double %21, double* %9
%22 = load double, double* %7
%23 = load double, double* %9
%24 = fdiv double %22, %23
store double %24, double* %10
%25 = load double, double* %7
%26 = load double, double* %9
%27 = call double @fmod(double %25, double %26)
store double %27, double* %7
%28 = load double, double* %9
%29 = fcmp oeq double %28, 1.000000e+02
br i1 %29, label %30, label %32
30: ; preds = %17
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %38
32: ; preds = %17
%33 = load double, double* %9
%34 = fcmp oeq double %33, 1.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %32
br label %38
38: ; preds = %37, %30
%39 = load double, double* %10
%40 = fadd double %39, 1.000000e-09
store double %40, double* %10
%41 = load double, double* %10
%42 = call double @llvm.floor.f64(double %41)
%43 = load double, double* %9
%44 = fcmp oge double %43, 2.000000e+00
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0)
%47 = load double, double* %9
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %42, i8* %46, double %47)
br label %49
49: ; preds = %38
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %13
52: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@__const.main.notes = [12 x double] [double 1.000000e+02, double 5.000000e+01, double 2.000000e+01, double 1.000000e+01, double 5.000000e+00, double 2.000000e+00, double 1.000000e+00, double 5.000000e-01, double 2.500000e-01, double 1.000000e-01, double 5.000000e-02, double 1.000000e-02]
@.str = [4 x i8] c"%lf\00"
@.str.3 = [23 x i8] c"%.0f %s(s) de R$ %.2f\0A\00"
@.str.4 = [5 x i8] c"nota\00"
@.str.5 = [6 x i8] c"moeda\00"
@str = [8 x i8] c"MOEDAS:\00"
@str.6 = [7 x i8] c"NOTAS:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
br label %6
6: ; preds = %2, %18
%7 = phi i64 [ 0, %2 ], [ %24, %18 ]
%8 = getelementptr inbounds [12 x double], [12 x double]* @__const.main.notes, i64 0, i64 %7
%9 = load double, double* %8
%10 = load double, double* %3
%11 = fdiv double %10, %9
%12 = call double @fmod(double %10, double %9)
store double %12, double* %3
%13 = trunc i64 %7 to i32
switch i32 %13, label %18 [
i32 0, label %15
i32 6, label %14
]
14: ; preds = %6
br label %15
15: ; preds = %6, %14
%16 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), %14 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.6, i64 0, i64 0), %6 ]
%17 = call i32 @puts(i8* dereferenceable(1) %16)
br label %18
18: ; preds = %15, %6
%19 = fadd double %11, 1.000000e-09
%20 = call double @llvm.floor.f64(double %19)
%21 = icmp ult i64 %7, 6
%22 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %20, i8* %22, double %9)
%24 = add nuw nsw i64 %7, 1
%25 = icmp eq i64 %24, 12
br i1 %25, label %26, label %6
26: ; preds = %18
ret i32 0
}