#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 *, int *);
int main(int argc, char **argv) {
  int ribuan, lima, dua, satu;
  int uang;
  printf("Masukkan uang dalam ratusan : ");
  scanf("%d", &uang);
  ribuan = uang / 1000;
  uang = uang % 1000;
  lima = uang / 500;
  uang = uang % 500;
  dua = uang / 200;
  uang = uang % 200;
  satu = uang / 100;
  if (ribuan > 0) {
    printf("Ada %d lembar ribuan\n", ribuan);
  }
  if (lima > 0) {
    printf("Ada %d koin lima ratus\n", lima);
  }
  if (dua > 0) {
    printf("Ada %d koin dua ratus\n", dua);
  }
  if (satu > 0) {
    printf("Ada %d koin seratus\n", satu);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11d1 <main+0xb1>
mov    -0x14(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jle    11ec <main+0xcc>
mov    -0x18(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    1207 <main+0xe7>
mov    -0x1c(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jle    1222 <main+0x102>
mov    -0x20(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
mov    %eax,%r14d
sub    %ecx,%r14d
movswl %r14w,%ecx
imul   $0xffff8313,%ecx,%ecx
shr    $0x10,%ecx
add    %r14d,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x8,%edx
add    %ecx,%edx
imul   $0x1f4,%edx,%ecx
mov    %r14d,%ebp
sub    %ecx,%ebp
movswl %bp,%r15d
imul   $0x147b,%r15d,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0x14,%ebx
add    %ecx,%ebx
imul   $0xc8,%ebx,%ecx
sub    %ecx,%ebp
movswl %bp,%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x3e8,%rax
jge    11f8 <main+0xd8>
cmp    $0x1f4,%r14d
jge    121c <main+0xfc>
cmp    $0xc8,%r15d
jge    1238 <main+0x118>
cmp    $0x64,%bp
jl     11eb <main+0xcb>
lea    0xe88(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%eax
imul   $0x10624dd3,%rax,%rsi
shr    $0x26,%rsi
lea    0xe16(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x1f4,%r14d
jl     11c9 <main+0xa9>
lea    0xe15(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0xc8,%r15d
jl     11d2 <main+0xb2>
lea    0xe11(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x64,%bp
jge    11d8 <main+0xb8>
jmp    11eb <main+0xcb>

LLVM IR (-O0):
@.str = [31 x i8] c"Masukkan uang dalam ratusan : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Ada %d lembar ribuan\0A\00"
@.str.3 = [24 x i8] c"Ada %d koin lima ratus\0A\00"
@.str.4 = [23 x i8] c"Ada %d koin dua ratus\0A\00"
@.str.5 = [21 x i8] c"Ada %d koin seratus\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%13 = load i32, i32* %10
%14 = sdiv i32 %13, 1000
store i32 %14, i32* %6
%15 = load i32, i32* %10
%16 = srem i32 %15, 1000
store i32 %16, i32* %10
%17 = load i32, i32* %10
%18 = sdiv i32 %17, 500
store i32 %18, i32* %7
%19 = load i32, i32* %10
%20 = srem i32 %19, 500
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = sdiv i32 %21, 200
store i32 %22, i32* %8
%23 = load i32, i32* %10
%24 = srem i32 %23, 200
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = sdiv i32 %25, 100
store i32 %26, i32* %9
%27 = load i32, i32* %6
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %2
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %2
%33 = load i32, i32* %7
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %35, %32
%39 = load i32, i32* %8
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %8
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41, %38
%45 = load i32, i32* %9
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* %9
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %47, %44
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Masukkan uang dalam ratusan : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Ada %d lembar ribuan\0A\00"
@.str.3 = [24 x i8] c"Ada %d koin lima ratus\0A\00"
@.str.4 = [23 x i8] c"Ada %d koin dua ratus\0A\00"
@.str.5 = [21 x i8] c"Ada %d koin seratus\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = srem i32 %7, 1000
%9 = trunc i32 %8 to i16
%10 = srem i16 %9, 500
%11 = sdiv i16 %10, 200
%12 = sext i16 %11 to i32
%13 = srem i16 %10, 200
%14 = sext i16 %13 to i32
store i32 %14, i32* %3
%15 = icmp sgt i32 %7, 999
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = udiv i32 %7, 1000
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %2
%20 = icmp sgt i32 %8, 499
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %23
23: ; preds = %21, %19
%24 = icmp sgt i16 %10, 199
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %12)
br label %27
27: ; preds = %25, %23
%28 = icmp sgt i16 %13, 99
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %31
31: ; preds = %29, %27
ret i32 0
}