#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, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int d[] = {100, 50, 20, 10, 5, 2, 1};
  int n, t = 0;
  scanf("%d", &n);
  printf("%d\n", n);
  do {
    printf("%d nota(s) de R$ %d,00\n", n / d[t], d[t]);
    if (n >= d[t])
      n -= d[t] * (n / d[t]);
  } while (d[t++] != 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
movslq -0x28(%rbp),%rcx
cltd
idivl  -0x20(%rbp,%rcx,4)
mov    %eax,%esi
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
movslq -0x28(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jl     11d5 <main+0xb5>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
mov    -0x24(%rbp),%eax
movslq -0x28(%rbp),%rsi
cltd
idivl  -0x20(%rbp,%rsi,4)
imul   %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
jmp    11da <main+0xba>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x28(%rbp)
cltq
cmpl   $0x1,-0x20(%rbp,%rax,4)
jne    1181 <main+0x61>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x25,%rsi
add    %eax,%esi
lea    0xea3(%rip),%rdi
mov    $0x64,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x64,%eax
jl     118f <main+0x6f>
mov    %eax,%ecx
imul   $0x51eb851f,%rcx,%rcx
shr    $0x25,%rcx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
cltq
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x24,%rsi
add    %eax,%esi
lea    0xe5b(%rip),%rdi
mov    $0x32,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x32,%eax
jl     11d7 <main+0xb7>
mov    %eax,%ecx
imul   $0x51eb851f,%rcx,%rcx
shr    $0x24,%rcx
imul   $0x32,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
cltq
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x23,%rsi
add    %eax,%esi
lea    0xe13(%rip),%rdi
mov    $0x14,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x14,%eax
jl     1224 <main+0x104>
mov    %eax,%ecx
mov    $0xcccccccd,%edx
imul   %rcx,%rdx
shr    $0x24,%rdx
shl    $0x2,%edx
lea    (%rdx,%rdx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
cltq
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
lea    0xdc6(%rip),%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0xa,%eax
jl     1270 <main+0x150>
mov    %eax,%ecx
mov    $0xcccccccd,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
cltq
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x21,%rsi
add    %eax,%esi
lea    0xd7a(%rip),%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x5,%eax
jl     12ba <main+0x19a>
mov    %eax,%ecx
mov    $0xcccccccd,%edx
imul   %rcx,%rdx
shr    $0x22,%rdx
lea    (%rdx,%rdx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
lea    0xd3d(%rip),%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
cmp    $0x2,%esi
jl     12e6 <main+0x1c6>
and    $0x1,%esi
mov    %esi,0x4(%rsp)
lea    0xd1a(%rip),%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.d = [7 x i32] [i32 100, i32 50, i32 20, i32 10, i32 5, i32 2, i32 1]
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [24 x i8] c"%d nota(s) de R$ %d,00\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [7 x i32]* %2 to i8*
store i32 0, i32* %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %42, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = sdiv i32 %10, %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %19)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = icmp sge i32 %21, %25
br i1 %26, label %27, label %41
27: ; preds = %9
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = sdiv i32 %32, %36
%38 = mul nsw i32 %31, %37
%39 = load i32, i32* %3
%40 = sub nsw i32 %39, %38
store i32 %40, i32* %3
br label %41
41: ; preds = %27, %9
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp ne i32 %47, 1
br i1 %48, label %9, label %49
49: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [24 x i8] c"%d nota(s) de R$ %d,00\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = sdiv i32 %6, 100
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 100)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 100
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = urem i32 %9, 100
store i32 %12, i32* %1
br label %13
13: ; preds = %0, %11
%14 = phi i32 [ %9, %0 ], [ %12, %11 ]
%15 = sdiv i32 %14, 50
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 50)
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 50
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = urem i32 %17, 50
store i32 %20, i32* %1
br label %21
21: ; preds = %19, %13
%22 = phi i32 [ %20, %19 ], [ %17, %13 ]
%23 = sdiv i32 %22, 20
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 20)
%25 = load i32, i32* %1
%26 = icmp slt i32 %25, 20
br i1 %26, label %29, label %27
27: ; preds = %21
%28 = urem i32 %25, 20
store i32 %28, i32* %1
br label %29
29: ; preds = %27, %21
%30 = phi i32 [ %28, %27 ], [ %25, %21 ]
%31 = sdiv i32 %30, 10
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 10)
%33 = load i32, i32* %1
%34 = icmp slt i32 %33, 10
br i1 %34, label %37, label %35
35: ; preds = %29
%36 = urem i32 %33, 10
store i32 %36, i32* %1
br label %37
37: ; preds = %35, %29
%38 = phi i32 [ %36, %35 ], [ %33, %29 ]
%39 = sdiv i32 %38, 5
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %39, i32 5)
%41 = load i32, i32* %1
%42 = icmp slt i32 %41, 5
br i1 %42, label %45, label %43
43: ; preds = %37
%44 = urem i32 %41, 5
store i32 %44, i32* %1
br label %45
45: ; preds = %43, %37
%46 = phi i32 [ %44, %43 ], [ %41, %37 ]
%47 = sdiv i32 %46, 2
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 2)
%49 = load i32, i32* %1
%50 = icmp slt i32 %49, 2
br i1 %50, label %53, label %51
51: ; preds = %45
%52 = and i32 %49, 1
store i32 %52, i32* %1
br label %53
53: ; preds = %51, %45
%54 = phi i32 [ %52, %51 ], [ %49, %45 ]
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %54, i32 1)
ret i32 0
}