#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 cash;
  int bills[7] = {100, 50, 20, 10, 5, 2, 1};
  scanf("%d", &cash);
  printf("%d\n", cash);
  int billsQtt;
  int i;
  for (i = 0; i < 7; i++) {
    billsQtt = cash / bills[i];
    cash = cash % bills[i];
    printf("%d nota(s) de R$ %d,00\n", billsQtt, bills[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x18(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x7,-0x38(%rbp)
jge    11d0 <main+0xb0>
mov    -0x8(%rbp),%eax
movslq -0x38(%rbp),%rcx
cltd
idivl  -0x30(%rbp,%rcx,4)
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
movslq -0x38(%rbp),%rcx
cltd
idivl  -0x30(%rbp,%rcx,4)
mov    %edx,-0x8(%rbp)
mov    -0x34(%rbp),%esi
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1181 <main+0x61>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rsi
add    %ecx,%esi
imul   $0x64,%esi,%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
lea    0xe96(%rip),%rbx
mov    %rbx,%rdi
mov    $0x64,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rsi
add    %ecx,%esi
imul   $0x32,%esi,%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x32,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rsi
add    %ecx,%esi
lea    0x0(,%rsi,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x14,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rsi
add    %ecx,%esi
lea    (%rsi,%rsi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rsi
add    %ecx,%esi
lea    (%rsi,%rsi,4),%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
mov    %ecx,%esi
sar    %esi
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.bills = [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 i32
%3 = alloca [7 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [7 x i32]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
store i32 0, i32* %5
br label %10
10: ; preds = %32, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 7
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = sdiv i32 %14, %18
store i32 %19, i32* %4
%20 = load i32, i32* %2
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = srem i32 %20, %24
store i32 %25, i32* %2
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %30)
br label %32
32: ; preds = %13
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %10
35: ; preds = %10
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 = srem i32 %6, 100
store i32 %8, i32* %1
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 100)
%10 = load i32, i32* %1
%11 = sdiv i32 %10, 50
%12 = srem i32 %10, 50
store i32 %12, i32* %1
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 50)
%14 = load i32, i32* %1
%15 = sdiv i32 %14, 20
%16 = srem i32 %14, 20
store i32 %16, i32* %1
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 20)
%18 = load i32, i32* %1
%19 = sdiv i32 %18, 10
%20 = srem i32 %18, 10
store i32 %20, i32* %1
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 10)
%22 = load i32, i32* %1
%23 = sdiv i32 %22, 5
%24 = srem i32 %22, 5
store i32 %24, i32* %1
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 5)
%26 = load i32, i32* %1
%27 = sdiv i32 %26, 2
%28 = srem i32 %26, 2
store i32 %28, i32* %1
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 2)
%30 = load i32, i32* %1
store i32 0, i32* %1
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 1)
ret i32 0
}