#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 *, double *);
int main() {
  int i, quantidade;
  int val;
  double valor;
  int cedula[6] = {100, 50, 20, 10, 5, 2};
  int moeda[6] = {100, 50, 25, 10, 5, 1};
  scanf("%lf", &valor);
  printf("NOTAS:\n");
  for (i = 0; i < 6; i++) {
    quantidade = (int)(valor / cedula[i]);
    valor -= quantidade * cedula[i];
    printf("%d nota(s) de R$ %.2f\n", quantidade, (float)cedula[i]);
  }
  printf("MOEDAS:\n");
  val = valor * 100;
  for (i = 0; i < 6; i++) {
    quantidade = val / moeda[i];
    val -= quantidade * moeda[i];
    printf("%d moeda(s) de R$ %.2lf\n", quantidade, moeda[i] / 100.0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1205 <main+0xe5>
movsd  -0x18(%rbp),%xmm0
movslq -0x8(%rbp),%rax
cvtsi2sdl -0x30(%rbp,%rax,4),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
imul   -0x30(%rbp,%rcx,4),%eax
cvtsi2sd %eax,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%esi
movslq -0x8(%rbp),%rax
cvtsi2ssl -0x30(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x76>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xde5(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1290 <main+0x170>
mov    -0x10(%rbp),%eax
movslq -0x8(%rbp),%rcx
cltd
idivl  -0x50(%rbp,%rcx,4)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
movslq -0x8(%rbp),%rax
imul   -0x50(%rbp,%rax,4),%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
movslq -0x8(%rbp),%rax
cvtsi2sdl -0x50(%rbp,%rax,4),%xmm0
movsd  0xd90(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdf9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    122e <main+0x10e>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf25(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
lea    0xf4a(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
movsd  0xea4(%rip),%xmm2
movapd %xmm0,%xmm1
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%esi
imul   $0x64,%esi,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
lea    0xee2(%rip),%rbx
mov    %rbx,%rdi
movapd %xmm2,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm1
movsd  0xe6b(%rip),%xmm0
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%esi
imul   $0x32,%esi,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm1
movsd  0xe3d(%rip),%xmm0
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%esi
lea    0x0(,%rsi,4),%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm1
movsd  0xe08(%rip),%xmm0
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%esi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm1
movsd  0xdd7(%rip),%xmm0
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%esi
lea    (%rsi,%rsi,4),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  0xda5(%rip),%xmm1
cvttsd2si %xmm1,%esi
lea    (%rsi,%rsi,1),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xd8e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xde8(%rip),%rdi
call   1030 <puts@plt>
movsd  0xd40(%rip),%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%eax
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x25,%rsi
add    %eax,%esi
imul   $0xffffff9c,%esi,%eax
add    %eax,%ebx
lea    0xd8f(%rip),%r14
movsd  0xd44(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movslq %ebx,%rbx
imul   $0x51eb851f,%rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x24,%rsi
add    %eax,%esi
imul   $0xffffffce,%esi,%eax
add    %eax,%ebx
mov    %r14,%rdi
movsd  0xd03(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movslq %ebx,%rbx
imul   $0x51eb851f,%rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x23,%rsi
add    %eax,%esi
imul   $0xffffffe7,%esi,%eax
add    %eax,%ebx
movsd  0xcf0(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movslq %ebx,%rbx
imul   $0x66666667,%rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
movsd  0xcc7(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movslq %ebx,%rbx
imul   $0x66666667,%rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x21,%rsi
add    %eax,%esi
lea    (%rsi,%rsi,4),%eax
sub    %eax,%ebx
movsd  0xca1(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xc97(%rip),%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.2 = [23 x i8] c"%d nota(s) de R$ %.2f\0A\00"
@.str.4 = [25 x i8] c"%d moeda(s) de R$ %.2lf\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 i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%5 = load double, double* %1
%6 = fdiv double %5, 1.000000e+02
%7 = fptosi double %6 to i32
%8 = mul nsw i32 %7, 100
%9 = sitofp i32 %8 to double
%10 = fsub double %5, %9
store double %10, double* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %7, double 1.000000e+02)
%12 = load double, double* %1
%13 = fdiv double %12, 5.000000e+01
%14 = fptosi double %13 to i32
%15 = mul nsw i32 %14, 50
%16 = sitofp i32 %15 to double
%17 = fsub double %12, %16
store double %17, double* %1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %14, double 5.000000e+01)
%19 = load double, double* %1
%20 = fdiv double %19, 2.000000e+01
%21 = fptosi double %20 to i32
%22 = mul nsw i32 %21, 20
%23 = sitofp i32 %22 to double
%24 = fsub double %19, %23
store double %24, double* %1
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %21, double 2.000000e+01)
%26 = load double, double* %1
%27 = fdiv double %26, 1.000000e+01
%28 = fptosi double %27 to i32
%29 = mul nsw i32 %28, 10
%30 = sitofp i32 %29 to double
%31 = fsub double %26, %30
store double %31, double* %1
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %28, double 1.000000e+01)
%33 = load double, double* %1
%34 = fdiv double %33, 5.000000e+00
%35 = fptosi double %34 to i32
%36 = mul nsw i32 %35, 5
%37 = sitofp i32 %36 to double
%38 = fsub double %33, %37
store double %38, double* %1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %35, double 5.000000e+00)
%40 = load double, double* %1
%41 = fmul double %40, 5.000000e-01
%42 = fptosi double %41 to i32
%43 = shl nsw i32 %42, 1
%44 = sitofp i32 %43 to double
%45 = fsub double %40, %44
store double %45, double* %1
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %42, double 2.000000e+00)
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
%48 = load double, double* %1
%49 = fmul double %48, 1.000000e+02
%50 = fptosi double %49 to i32
%51 = sdiv i32 %50, 100
%52 = mul nsw i32 %51, -100
%53 = add i32 %52, %50
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %51, double 1.000000e+00)
%55 = sdiv i32 %53, 50
%56 = mul nsw i32 %55, -50
%57 = add i32 %56, %53
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %55, double 5.000000e-01)
%59 = sdiv i32 %57, 25
%60 = mul nsw i32 %59, -25
%61 = add i32 %60, %57
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %59, double 2.500000e-01)
%63 = sdiv i32 %61, 10
%64 = mul nsw i32 %63, -10
%65 = add i32 %64, %61
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %63, double 1.000000e-01)
%67 = sdiv i32 %65, 5
%68 = mul nsw i32 %67, -5
%69 = add i32 %68, %65
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %67, double 5.000000e-02)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %69, double 1.000000e-02)
ret i32 0
}