#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int money, m50 = 0, m20 = 0, m10 = 0;
  int *coin = &money;
  printf("½Ð¿é¤J·Q§I´«ªºª÷ÃB¡G");
  scanf("%d", &money);
  if (money == 50) {
    m20 = *coin / 20;
    money %= 20;
    m10 = money / 10;
  } else if (money == 20) {
    m10 = money / 10;
  } else {
    m50 = *coin / 50;
    if (m50 > 100) {
      money = (money % 50) + (m50 - 100) * 50;
      m50 = 100;
    }
    m20 = *coin / 20;
    if (m20 > 100) {
      money = (money % 20) + (m20 - 100) * 20;
      m20 = 100;
    }
    m10 = money / 10;
    if (m10 > 500) {
      money = (money % 10) + (m50 - 500) * 10;
      m10 = 500;
    }
  }
  printf("§I´«§¹²¦¡G\n 50¤¸¡G%d­Ó\n 20¤¸¡G%d­Ó\n 10¤¸¡G%d­Ó\n", m50, m20, m10);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x32,-0x8(%rbp)
jne    11a6 <main+0x86>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    1280 <main+0x160>
cmpl   $0x14,-0x8(%rbp)
jne    11c3 <main+0xa3>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    127b <main+0x15b>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jle    11fe <main+0xde>
mov    -0x8(%rbp),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
sub    $0x64,%eax
imul   $0x32,%eax,%eax
add    %eax,%edx
mov    %edx,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jle    1239 <main+0x119>
mov    -0x8(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
sub    $0x64,%eax
imul   $0x14,%eax,%eax
add    %eax,%edx
mov    %edx,-0x8(%rbp)
movl   $0x64,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x1f4,-0x14(%rbp)
jle    1276 <main+0x156>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
sub    $0x1f4,%eax
imul   $0xa,%eax,%eax
add    %eax,%edx
mov    %edx,-0x8(%rbp)
movl   $0x1f4,-0x14(%rbp)
jmp    127b <main+0x15b>
jmp    1280 <main+0x160>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x14,%eax
je     116b <main+0x4b>
cmp    $0x32,%eax
jne    1177 <main+0x57>
movl   $0xa,0xc(%rsp)
mov    $0x1,%ecx
mov    $0x2,%edx
jmp    1253 <main+0x133>
mov    $0x2,%ecx
xor    %edx,%edx
jmp    1253 <main+0x133>
movslq %eax,%rcx
imul   $0x51eb851f,%rcx,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rbx
add    %ecx,%ebx
cmp    $0x13ba,%eax
jl     11ba <main+0x9a>
mov    %eax,%ecx
imul   $0x51eb851f,%rcx,%rcx
shr    $0x24,%rcx
imul   $0x32,%ecx,%ecx
sub    %ecx,%eax
imul   $0x32,%ebx,%ecx
add    %ecx,%eax
add    $0xffffec78,%eax
mov    %eax,0xc(%rsp)
mov    $0x64,%ebx
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
mov    %rcx,%rdx
sar    $0x23,%rdx
add    %esi,%edx
cmp    $0x7e3,%edi
jle    1235 <main+0x115>
mov    %eax,%esi
mov    $0xcccccccd,%ecx
imul   %rcx,%rsi
shr    $0x24,%rsi
shl    $0x2,%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%eax
lea    (%rdx,%rdx,4),%edx
lea    (%rax,%rdx,4),%eax
add    $0xfffff830,%eax
mov    %eax,0xc(%rsp)
mov    $0x64,%edx
cmp    $0x1392,%eax
jl     123d <main+0x11d>
mov    %eax,%esi
imul   %rcx,%rsi
shr    $0x23,%rsi
add    %esi,%esi
lea    (%rsi,%rsi,4),%ecx
sub    %ecx,%eax
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%eax
add    $0xffffec78,%eax
mov    %eax,0xc(%rsp)
mov    $0x1f4,%ecx
jmp    1253 <main+0x133>
sar    $0x22,%rcx
add    %esi,%ecx
jmp    1253 <main+0x133>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x22,%rcx
add    %eax,%ecx
lea    0xdcd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2d76(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\C2\BD\C3\90\C2\BF\C3\A9\C2\A4J\C2\B7Q\C2\A7I\C2\B4\C2\AB\C2\AA\C2\BA\C2\AA\C3\B7\C3\83B\C2\A1G\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [71 x i8] c"\C2\A7I\C2\B4\C2\AB\C2\A7\C2\B9\C2\B2\C2\A6\C2\A1G\0A 50\C2\A4\C2\B8\C2\A1G%d\C2\AD\C3\93\0A 20\C2\A4\C2\B8\C2\A1G%d\C2\AD\C3\93\0A 10\C2\A4\C2\B8\C2\A1G%d\C2\AD\C3\93\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32* %2, i32** %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 50
br i1 %10, label %11, label %19
11: ; preds = %0
%12 = load i32*, i32** %6
%13 = load i32, i32* %12
%14 = sdiv i32 %13, 20
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = srem i32 %15, 20
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = sdiv i32 %17, 10
store i32 %18, i32* %5
br label %65
19: ; preds = %0
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 20
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sdiv i32 %23, 10
store i32 %24, i32* %5
br label %64
25: ; preds = %19
%26 = load i32*, i32** %6
%27 = load i32, i32* %26
%28 = sdiv i32 %27, 50
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = icmp sgt i32 %29, 100
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = load i32, i32* %2
%33 = srem i32 %32, 50
%34 = load i32, i32* %3
%35 = sub nsw i32 %34, 100
%36 = mul nsw i32 %35, 50
%37 = add nsw i32 %33, %36
store i32 %37, i32* %2
store i32 100, i32* %3
br label %38
38: ; preds = %31, %25
%39 = load i32*, i32** %6
%40 = load i32, i32* %39
%41 = sdiv i32 %40, 20
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = icmp sgt i32 %42, 100
br i1 %43, label %44, label %51
44: ; preds = %38
%45 = load i32, i32* %2
%46 = srem i32 %45, 20
%47 = load i32, i32* %4
%48 = sub nsw i32 %47, 100
%49 = mul nsw i32 %48, 20
%50 = add nsw i32 %46, %49
store i32 %50, i32* %2
store i32 100, i32* %4
br label %51
51: ; preds = %44, %38
%52 = load i32, i32* %2
%53 = sdiv i32 %52, 10
store i32 %53, i32* %5
%54 = load i32, i32* %5
%55 = icmp sgt i32 %54, 500
br i1 %55, label %56, label %63
56: ; preds = %51
%57 = load i32, i32* %2
%58 = srem i32 %57, 10
%59 = load i32, i32* %3
%60 = sub nsw i32 %59, 500
%61 = mul nsw i32 %60, 10
%62 = add nsw i32 %58, %61
store i32 %62, i32* %2
store i32 500, i32* %5
br label %63
63: ; preds = %56, %51
br label %64
64: ; preds = %63, %22
br label %65
65: ; preds = %64, %11
%66 = load i32, i32* %3
%67 = load i32, i32* %4
%68 = load i32, i32* %5
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i32 %66, i32 %67, i32 %68)
%70 = load i32, i32* @EXIT_SUCCESS
ret i32 %70
}

LLVM IR (-O2):
@.str = [36 x i8] c"\C2\BD\C3\90\C2\BF\C3\A9\C2\A4J\C2\B7Q\C2\A7I\C2\B4\C2\AB\C2\AA\C2\BA\C2\AA\C3\B7\C3\83B\C2\A1G\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [71 x i8] c"\C2\A7I\C2\B4\C2\AB\C2\A7\C2\B9\C2\B2\C2\A6\C2\A1G\0A 50\C2\A4\C2\B8\C2\A1G%d\C2\AD\C3\93\0A 20\C2\A4\C2\B8\C2\A1G%d\C2\AD\C3\93\0A 10\C2\A4\C2\B8\C2\A1G%d\C2\AD\C3\93\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %7 [
i32 50, label %6
i32 20, label %34
]
6: ; preds = %0
store i32 10, i32* %1
br label %34
7: ; preds = %0
%8 = sdiv i32 %5, 50
%9 = icmp sgt i32 %5, 5049
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = urem i32 %5, 50
%12 = mul nsw i32 %8, 50
%13 = add nuw nsw i32 %11, -5000
%14 = add i32 %13, %12
store i32 %14, i32* %1
br label %15
15: ; preds = %10, %7
%16 = phi i32 [ %14, %10 ], [ %5, %7 ]
%17 = phi i32 [ 100, %10 ], [ %8, %7 ]
%18 = sdiv i32 %16, 20
%19 = icmp sgt i32 %16, 2019
br i1 %19, label %22, label %20
20: ; preds = %15
%21 = sdiv i32 %16, 10
br label %34
22: ; preds = %15
%23 = urem i32 %16, 20
%24 = mul nsw i32 %18, 20
%25 = add nuw nsw i32 %23, -2000
%26 = add i32 %25, %24
store i32 %26, i32* %1
%27 = sdiv i32 %26, 10
%28 = icmp sgt i32 %26, 5009
br i1 %28, label %29, label %34
29: ; preds = %22
%30 = urem i32 %26, 10
%31 = mul nsw i32 %17, 10
%32 = add nsw i32 %31, -5000
%33 = add nsw i32 %32, %30
store i32 %33, i32* %1
br label %34
34: ; preds = %20, %0, %29, %22, %6
%35 = phi i32 [ 2, %6 ], [ 100, %29 ], [ 100, %22 ], [ 0, %0 ], [ %18, %20 ]
%36 = phi i32 [ 1, %6 ], [ 500, %29 ], [ %27, %22 ], [ 2, %0 ], [ %21, %20 ]
%37 = phi i32 [ 0, %6 ], [ %17, %29 ], [ %17, %22 ], [ 0, %0 ], [ %17, %20 ]
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %35, i32 %36)
%39 = load i32, i32* @EXIT_SUCCESS
ret i32 %39
}