#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 *);
void Problem12() {
  double n, twenc, tenc, fivec, onec;
  int thou, five, thund, hund, fifth, twen, ten, fives, ones, i = 0;
  printf("Problem 12: Given a peso amount, print out its equivalent standard "
         "peso currency using the least number of denominations.\n");
  printf("Enter a peso amount: ");
  scanf("%lf", &n);
  printf("The output is: %.2lf = ", n);
  if (n >= 1000) {
    thou = (int)n / 1000;
    printf("(%d) 1000 ", thou);
    n = n - 1000 * thou;
    i++;
  }
  if (n >= 500) {
    five = (int)n / 500;
    if (i == 0) {
      printf("(%d) 500 ", five);
      i++;
    } else {
      printf("+ (%d) 500 ", five);
    }
    n = n - 500 * five;
  }
  if (n >= 200) {
    thund = (int)n / 200;
    if (i == 0) {
      printf("(%d) 200 ", thund);
      i++;
    } else {
      printf("+ (%d) 200 ", thund);
    }
    n = n - 200 * thund;
  }
  if (n >= 100) {
    hund = (int)n / 100;
    if (i == 0) {
      printf("(%d) 100", hund);
      i++;
    } else {
      printf("+ (%d) 100 ", hund);
    }
    n = n - 100 * hund;
  }
  if (n >= 50) {
    fifth = (int)n / 50;
    if (i == 0) {
      printf("(%d) 50 ", fifth);
      i++;
    } else {
      printf("+ (%d) 50 ", fifth);
    }
    n = n - 50 * fifth;
  }
  if (n >= 20) {
    twen = (int)n / 20;
    if (i == 0) {
      printf("(%d) 20 ", twen);
      i++;
    } else {
      printf("+ (%d) 20 ", twen);
    }
    n = n - 20 * twen;
  }
  if (n >= 10) {
    ten = (int)n / 10;
    if (i == 0) {
      printf("(%d) 10 ", ten);
      i++;
    } else {
      printf("+ (%d) 10 ", ten);
    }
    n = n - 10 * ten;
  }
  if (n >= 5) {
    fives = (int)n / 5;
    if (i == 0) {
      printf("(%d) 5 ", fives);
      i++;
    } else {
      printf("+ (%d) 5 ", fives);
    }
    n = n - 5 * fives;
  }
  if (n >= 1) {
    ones = (int)n;
    if (i == 0) {
      printf("(%d) 1 ", ones);
      i++;
    } else {
      printf("+ (%d) 1 ", ones);
    }
    n = n - ones;
  }
  if (n >= 0.25) {
    twenc = n / 0.25;
    if (i == 0) {
      printf("(%.0lf) 0.25 ", twenc);
      i++;
    } else {
      printf("+ (%.0lf) 0.25 ", twenc);
    }
    n = n - 0.25 * twenc;
  }
  if (n >= 0.10) {
    tenc = n / 0.10;
    if (i == 0) {
      printf("(%.0lf) 0.10 ", tenc);
      i++;
    } else {
      printf("+ (%.0lf) 0.10 ", tenc);
    }
    n = n - 0.10 * tenc;
  }
  if (n >= 0.05) {
    fivec = n / 0.05;
    if (i == 0) {
      printf("(%.0lf) 0.05 ", fivec);
      i++;
    } else {
      printf("+ (%.0lf) 0.05 ", fivec);
    }
    n = n - 0.05 * fivec;
  }
  if (n >= 0.01) {
    onec = n / 0.01;
    if (i == 0) {
      printf("(%.0lf) 0.01 ", onec);
    } else {
      printf("+ (%.0lf) 0.01 ", onec);
    }
    n = n - 0.01 * onec;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<Problem12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x50(%rbp)
lea    0xf52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfc7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xfb6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11c8 <Problem12+0xa8>
cvttsd2si -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xf96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0x3e8,-0x2c(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe33(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1242 <Problem12+0x122>
cvttsd2si -0x8(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1218 <Problem12+0xf8>
mov    -0x30(%rbp),%esi
lea    0xf3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1229 <Problem12+0x109>
mov    -0x30(%rbp),%esi
lea    0xf1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0x1f4,-0x30(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xdc1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12bc <Problem12+0x19c>
cvttsd2si -0x8(%rbp),%eax
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1292 <Problem12+0x172>
mov    -0x34(%rbp),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12a3 <Problem12+0x183>
mov    -0x34(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0xc8,-0x34(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd4f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1333 <Problem12+0x213>
cvttsd2si -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    130c <Problem12+0x1ec>
mov    -0x38(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    131d <Problem12+0x1fd>
mov    -0x38(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0x64,-0x38(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xce0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     13aa <Problem12+0x28a>
cvttsd2si -0x8(%rbp),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1383 <Problem12+0x263>
mov    -0x3c(%rbp),%esi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1394 <Problem12+0x274>
mov    -0x3c(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0x32,-0x3c(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xc71(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1421 <Problem12+0x301>
cvttsd2si -0x8(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    13fa <Problem12+0x2da>
mov    -0x40(%rbp),%esi
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    140b <Problem12+0x2eb>
mov    -0x40(%rbp),%esi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0x14,-0x40(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xc02(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1498 <Problem12+0x378>
cvttsd2si -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1471 <Problem12+0x351>
mov    -0x44(%rbp),%esi
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1482 <Problem12+0x362>
mov    -0x44(%rbp),%esi
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0xa,-0x44(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xb93(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     150f <Problem12+0x3ef>
cvttsd2si -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    14e8 <Problem12+0x3c8>
mov    -0x48(%rbp),%esi
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    14f9 <Problem12+0x3d9>
mov    -0x48(%rbp),%esi
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
imul   $0x5,-0x48(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xb24(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     157b <Problem12+0x45b>
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1557 <Problem12+0x437>
mov    -0x4c(%rbp),%esi
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1568 <Problem12+0x448>
mov    -0x4c(%rbp),%esi
lea    0xc37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x4c(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xac0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1605 <Problem12+0x4e5>
movsd  -0x8(%rbp),%xmm0
movsd  0xaa9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    15d3 <Problem12+0x4b3>
movsd  -0x10(%rbp),%xmm0
lea    0xbe6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    15e6 <Problem12+0x4c6>
movsd  -0x10(%rbp),%xmm0
lea    0xbc3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xa58(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xa46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     168f <Problem12+0x56f>
movsd  -0x8(%rbp),%xmm0
movsd  0xa2f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    165d <Problem12+0x53d>
movsd  -0x18(%rbp),%xmm0
lea    0xb6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1670 <Problem12+0x550>
movsd  -0x18(%rbp),%xmm0
lea    0xb49(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0x9de(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0x9cc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1719 <Problem12+0x5f9>
movsd  -0x8(%rbp),%xmm0
movsd  0x9b5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    16e7 <Problem12+0x5c7>
movsd  -0x20(%rbp),%xmm0
lea    0xaf2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    16fa <Problem12+0x5da>
movsd  -0x20(%rbp),%xmm0
lea    0xacf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0x964(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0x952(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     179a <Problem12+0x67a>
movsd  -0x8(%rbp),%xmm0
movsd  0x93b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    1768 <Problem12+0x648>
movsd  -0x28(%rbp),%xmm0
lea    0xa78(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    177b <Problem12+0x65b>
movsd  -0x28(%rbp),%xmm0
lea    0xa5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0x8f3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    0x960(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Problem12>:
push   %rbx
sub    $0x10,%rsp
lea    0x1023(%rip),%rdi
call   1040 <puts@plt>
lea    0xf38(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf40(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
movsd  (%rsp),%xmm0
lea    0xf30(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe72(%rip),%xmm0
jae    1256 <Problem12+0x116>
ucomisd 0xe6c(%rip),%xmm0
jae    1345 <Problem12+0x205>
ucomisd 0xe66(%rip),%xmm0
jae    13de <Problem12+0x29e>
ucomisd 0xe60(%rip),%xmm0
jae    1703 <Problem12+0x5c3>
ucomisd 0xe5a(%rip),%xmm0
jae    1729 <Problem12+0x5e9>
ucomisd 0xe54(%rip),%xmm0
jae    174f <Problem12+0x60f>
ucomisd 0xe4e(%rip),%xmm0
jae    1775 <Problem12+0x635>
ucomisd 0xe48(%rip),%xmm0
jae    179b <Problem12+0x65b>
ucomisd 0xe42(%rip),%xmm0
jae    17c1 <Problem12+0x681>
ucomisd 0xe3c(%rip),%xmm0
jae    17d1 <Problem12+0x691>
ucomisd 0xe46(%rip),%xmm0
jae    17eb <Problem12+0x6ab>
ucomisd 0xe40(%rip),%xmm0
jae    1805 <Problem12+0x6c5>
ucomisd 0xe4a(%rip),%xmm0
jb     16f3 <Problem12+0x5b3>
divsd  0xe3c(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xf10(%rip),%rdi
jmp    16d4 <Problem12+0x594>
cvttsd2si %xmm0,%eax
cltq
imul   $0x10624dd3,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x26,%rbx
add    %eax,%ebx
lea    0xe4b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
imul   $0x3e8,%ebx,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xd68(%rip),%xmm0
jae    1368 <Problem12+0x228>
ucomisd 0xd62(%rip),%xmm0
jae    13bb <Problem12+0x27b>
ucomisd 0xd5c(%rip),%xmm0
jae    1431 <Problem12+0x2f1>
ucomisd 0xd56(%rip),%xmm0
jae    1481 <Problem12+0x341>
ucomisd 0xd50(%rip),%xmm0
jae    14d1 <Problem12+0x391>
ucomisd 0xd4a(%rip),%xmm0
jae    1524 <Problem12+0x3e4>
ucomisd 0xd44(%rip),%xmm0
jae    1576 <Problem12+0x436>
ucomisd 0xd3e(%rip),%xmm0
jae    15c6 <Problem12+0x486>
ucomisd 0xd38(%rip),%xmm0
jae    15fd <Problem12+0x4bd>
ucomisd 0xd42(%rip),%xmm0
jae    163f <Problem12+0x4ff>
ucomisd 0xd3c(%rip),%xmm0
jae    1681 <Problem12+0x541>
ucomisd 0xd46(%rip),%xmm0
jae    16bf <Problem12+0x57f>
jmp    16f3 <Problem12+0x5b3>
cvttsd2si %xmm0,%eax
cltq
imul   $0x10624dd3,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
lea    0xd69(%rip),%rdi
jmp    1389 <Problem12+0x249>
cvttsd2si %xmm0,%eax
cltq
imul   $0x10624dd3,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
lea    0xd44(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
imul   $0x1f4,%ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xc5b(%rip),%xmm0
jb     12b4 <Problem12+0x174>
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x26,%rbx
add    %eax,%ebx
lea    0xcfd(%rip),%rdi
jmp    13ff <Problem12+0x2bf>
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x26,%rbx
add    %eax,%ebx
lea    0xcdc(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
imul   $0xc8,%ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xbed(%rip),%xmm0
jb     12c2 <Problem12+0x182>
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
lea    0xc9c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
imul   $0x64,%ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xba5(%rip),%xmm0
jb     12d0 <Problem12+0x190>
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x24,%rbx
add    %eax,%ebx
lea    0xc58(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
imul   $0x32,%ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xb5d(%rip),%xmm0
jb     12de <Problem12+0x19e>
cvttsd2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x23,%rbx
add    %eax,%ebx
lea    0xc13(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
shl    $0x2,%ebx
lea    (%rbx,%rbx,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xb12(%rip),%xmm0
jb     12ec <Problem12+0x1ac>
cvttsd2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    0xbcb(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xac8(%rip),%xmm0
jb     12fa <Problem12+0x1ba>
cvttsd2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    0xb84(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
lea    (%rbx,%rbx,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xa80(%rip),%xmm0
jb     1308 <Problem12+0x1c8>
cvttsd2si %xmm0,%ebx
lea    0xb54(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xa51(%rip),%xmm0
jb     1316 <Problem12+0x1d6>
mulsd  0xa4b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xb1d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xa31(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0xa27(%rip),%xmm0
jb     1324 <Problem12+0x1e4>
divsd  0xa19(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xaeb(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xa07(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0x9ed(%rip),%xmm0
jb     1332 <Problem12+0x1f2>
divsd  0x9df(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xab9(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0x9cd(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
ucomisd 0x9c3(%rip),%xmm0
jb     16f3 <Problem12+0x5b3>
divsd  0x9b9(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xa8b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0x99f(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
lea    0x9c1(%rip),%rdi
jmp    1452 <Problem12+0x312>
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x24,%rbx
add    %eax,%ebx
lea    0x9b2(%rip),%rdi
jmp    14a2 <Problem12+0x362>
cvttsd2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x23,%rbx
add    %eax,%ebx
lea    0x997(%rip),%rdi
jmp    14f2 <Problem12+0x3b2>
cvttsd2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    0x97c(%rip),%rdi
jmp    1545 <Problem12+0x405>
cvttsd2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    0x961(%rip),%rdi
jmp    1597 <Problem12+0x457>
cvttsd2si %xmm0,%ebx
lea    0x95b(%rip),%rdi
jmp    15d1 <Problem12+0x491>
mulsd  0x877(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x94b(%rip),%rdi
jmp    1612 <Problem12+0x4d2>
divsd  0x86d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x941(%rip),%rdi
jmp    1654 <Problem12+0x514>
divsd  0x85b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x937(%rip),%rdi
jmp    1696 <Problem12+0x556>

LLVM IR (-O0):
@.str = [123 x i8] c"Problem 12: Given a peso amount, print out its equivalent standard peso currency using the least number of denominations.\0A\00"
@.str.1 = [22 x i8] c"Enter a peso amount: \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [24 x i8] c"The output is: %.2lf = \00"
@.str.4 = [11 x i8] c"(%d) 1000 \00"
@.str.5 = [10 x i8] c"(%d) 500 \00"
@.str.6 = [12 x i8] c"+ (%d) 500 \00"
@.str.7 = [10 x i8] c"(%d) 200 \00"
@.str.8 = [12 x i8] c"+ (%d) 200 \00"
@.str.9 = [9 x i8] c"(%d) 100\00"
@.str.10 = [12 x i8] c"+ (%d) 100 \00"
@.str.11 = [9 x i8] c"(%d) 50 \00"
@.str.12 = [11 x i8] c"+ (%d) 50 \00"
@.str.13 = [9 x i8] c"(%d) 20 \00"
@.str.14 = [11 x i8] c"+ (%d) 20 \00"
@.str.15 = [9 x i8] c"(%d) 10 \00"
@.str.16 = [11 x i8] c"+ (%d) 10 \00"
@.str.17 = [8 x i8] c"(%d) 5 \00"
@.str.18 = [10 x i8] c"+ (%d) 5 \00"
@.str.19 = [8 x i8] c"(%d) 1 \00"
@.str.20 = [10 x i8] c"+ (%d) 1 \00"
@.str.21 = [14 x i8] c"(%.0lf) 0.25 \00"
@.str.22 = [16 x i8] c"+ (%.0lf) 0.25 \00"
@.str.23 = [14 x i8] c"(%.0lf) 0.10 \00"
@.str.24 = [16 x i8] c"+ (%.0lf) 0.10 \00"
@.str.25 = [14 x i8] c"(%.0lf) 0.05 \00"
@.str.26 = [16 x i8] c"+ (%.0lf) 0.05 \00"
@.str.27 = [14 x i8] c"(%.0lf) 0.01 \00"
@.str.28 = [16 x i8] c"+ (%.0lf) 0.01 \00"
@.str.29 = [2 x i8] c"\0A\00"
define void @Problem12() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %15
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([123 x i8], [123 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%19 = load double, double* %1
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = load double, double* %1
%22 = fcmp oge double %21, 1.000000e+03
br i1 %22, label %23, label %36
23: ; preds = %0
%24 = load double, double* %1
%25 = fptosi double %24 to i32
%26 = sdiv i32 %25, 1000
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = load double, double* %1
%30 = load i32, i32* %6
%31 = mul nsw i32 1000, %30
%32 = sitofp i32 %31 to double
%33 = fsub double %29, %32
store double %33, double* %1
%34 = load i32, i32* %15
%35 = add nsw i32 %34, 1
store i32 %35, i32* %15
br label %36
36: ; preds = %23, %0
%37 = load double, double* %1
%38 = fcmp oge double %37, 5.000000e+02
br i1 %38, label %39, label %59
39: ; preds = %36
%40 = load double, double* %1
%41 = fptosi double %40 to i32
%42 = sdiv i32 %41, 500
store i32 %42, i32* %7
%43 = load i32, i32* %15
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %39
%46 = load i32, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %15
%49 = add nsw i32 %48, 1
store i32 %49, i32* %15
br label %53
50: ; preds = %39
%51 = load i32, i32* %7
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %50, %45
%54 = load double, double* %1
%55 = load i32, i32* %7
%56 = mul nsw i32 500, %55
%57 = sitofp i32 %56 to double
%58 = fsub double %54, %57
store double %58, double* %1
br label %59
59: ; preds = %53, %36
%60 = load double, double* %1
%61 = fcmp oge double %60, 2.000000e+02
br i1 %61, label %62, label %82
62: ; preds = %59
%63 = load double, double* %1
%64 = fptosi double %63 to i32
%65 = sdiv i32 %64, 200
store i32 %65, i32* %8
%66 = load i32, i32* %15
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %62
%69 = load i32, i32* %8
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %15
%72 = add nsw i32 %71, 1
store i32 %72, i32* %15
br label %76
73: ; preds = %62
%74 = load i32, i32* %8
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %73, %68
%77 = load double, double* %1
%78 = load i32, i32* %8
%79 = mul nsw i32 200, %78
%80 = sitofp i32 %79 to double
%81 = fsub double %77, %80
store double %81, double* %1
br label %82
82: ; preds = %76, %59
%83 = load double, double* %1
%84 = fcmp oge double %83, 1.000000e+02
br i1 %84, label %85, label %105
85: ; preds = %82
%86 = load double, double* %1
%87 = fptosi double %86 to i32
%88 = sdiv i32 %87, 100
store i32 %88, i32* %9
%89 = load i32, i32* %15
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %96
91: ; preds = %85
%92 = load i32, i32* %9
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %15
%95 = add nsw i32 %94, 1
store i32 %95, i32* %15
br label %99
96: ; preds = %85
%97 = load i32, i32* %9
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %97)
br label %99
99: ; preds = %96, %91
%100 = load double, double* %1
%101 = load i32, i32* %9
%102 = mul nsw i32 100, %101
%103 = sitofp i32 %102 to double
%104 = fsub double %100, %103
store double %104, double* %1
br label %105
105: ; preds = %99, %82
%106 = load double, double* %1
%107 = fcmp oge double %106, 5.000000e+01
br i1 %107, label %108, label %128
108: ; preds = %105
%109 = load double, double* %1
%110 = fptosi double %109 to i32
%111 = sdiv i32 %110, 50
store i32 %111, i32* %10
%112 = load i32, i32* %15
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %119
114: ; preds = %108
%115 = load i32, i32* %10
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %15
%118 = add nsw i32 %117, 1
store i32 %118, i32* %15
br label %122
119: ; preds = %108
%120 = load i32, i32* %10
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %120)
br label %122
122: ; preds = %119, %114
%123 = load double, double* %1
%124 = load i32, i32* %10
%125 = mul nsw i32 50, %124
%126 = sitofp i32 %125 to double
%127 = fsub double %123, %126
store double %127, double* %1
br label %128
128: ; preds = %122, %105
%129 = load double, double* %1
%130 = fcmp oge double %129, 2.000000e+01
br i1 %130, label %131, label %151
131: ; preds = %128
%132 = load double, double* %1
%133 = fptosi double %132 to i32
%134 = sdiv i32 %133, 20
store i32 %134, i32* %11
%135 = load i32, i32* %15
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %142
137: ; preds = %131
%138 = load i32, i32* %11
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i32 %138)
%140 = load i32, i32* %15
%141 = add nsw i32 %140, 1
store i32 %141, i32* %15
br label %145
142: ; preds = %131
%143 = load i32, i32* %11
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 %143)
br label %145
145: ; preds = %142, %137
%146 = load double, double* %1
%147 = load i32, i32* %11
%148 = mul nsw i32 20, %147
%149 = sitofp i32 %148 to double
%150 = fsub double %146, %149
store double %150, double* %1
br label %151
151: ; preds = %145, %128
%152 = load double, double* %1
%153 = fcmp oge double %152, 1.000000e+01
br i1 %153, label %154, label %174
154: ; preds = %151
%155 = load double, double* %1
%156 = fptosi double %155 to i32
%157 = sdiv i32 %156, 10
store i32 %157, i32* %12
%158 = load i32, i32* %15
%159 = icmp eq i32 %158, 0
br i1 %159, label %160, label %165
160: ; preds = %154
%161 = load i32, i32* %12
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32 %161)
%163 = load i32, i32* %15
%164 = add nsw i32 %163, 1
store i32 %164, i32* %15
br label %168
165: ; preds = %154
%166 = load i32, i32* %12
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %166)
br label %168
168: ; preds = %165, %160
%169 = load double, double* %1
%170 = load i32, i32* %12
%171 = mul nsw i32 10, %170
%172 = sitofp i32 %171 to double
%173 = fsub double %169, %172
store double %173, double* %1
br label %174
174: ; preds = %168, %151
%175 = load double, double* %1
%176 = fcmp oge double %175, 5.000000e+00
br i1 %176, label %177, label %197
177: ; preds = %174
%178 = load double, double* %1
%179 = fptosi double %178 to i32
%180 = sdiv i32 %179, 5
store i32 %180, i32* %13
%181 = load i32, i32* %15
%182 = icmp eq i32 %181, 0
br i1 %182, label %183, label %188
183: ; preds = %177
%184 = load i32, i32* %13
%185 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i32 %184)
%186 = load i32, i32* %15
%187 = add nsw i32 %186, 1
store i32 %187, i32* %15
br label %191
188: ; preds = %177
%189 = load i32, i32* %13
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0), i32 %189)
br label %191
191: ; preds = %188, %183
%192 = load double, double* %1
%193 = load i32, i32* %13
%194 = mul nsw i32 5, %193
%195 = sitofp i32 %194 to double
%196 = fsub double %192, %195
store double %196, double* %1
br label %197
197: ; preds = %191, %174
%198 = load double, double* %1
%199 = fcmp oge double %198, 1.000000e+00
br i1 %199, label %200, label %218
200: ; preds = %197
%201 = load double, double* %1
%202 = fptosi double %201 to i32
store i32 %202, i32* %14
%203 = load i32, i32* %15
%204 = icmp eq i32 %203, 0
br i1 %204, label %205, label %210
205: ; preds = %200
%206 = load i32, i32* %14
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i32 %206)
%208 = load i32, i32* %15
%209 = add nsw i32 %208, 1
store i32 %209, i32* %15
br label %213
210: ; preds = %200
%211 = load i32, i32* %14
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i32 %211)
br label %213
213: ; preds = %210, %205
%214 = load double, double* %1
%215 = load i32, i32* %14
%216 = sitofp i32 %215 to double
%217 = fsub double %214, %216
store double %217, double* %1
br label %218
218: ; preds = %213, %197
%219 = load double, double* %1
%220 = fcmp oge double %219, 2.500000e-01
br i1 %220, label %221, label %238
221: ; preds = %218
%222 = load double, double* %1
%223 = fdiv double %222, 2.500000e-01
store double %223, double* %2
%224 = load i32, i32* %15
%225 = icmp eq i32 %224, 0
br i1 %225, label %226, label %231
226: ; preds = %221
%227 = load double, double* %2
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0), double %227)
%229 = load i32, i32* %15
%230 = add nsw i32 %229, 1
store i32 %230, i32* %15
br label %234
231: ; preds = %221
%232 = load double, double* %2
%233 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), double %232)
br label %234
234: ; preds = %231, %226
%235 = load double, double* %1
%236 = load double, double* %2
%237 = call double @llvm.fmuladd.f64(double -2.500000e-01, double %236, double %235)
store double %237, double* %1
br label %238
238: ; preds = %234, %218
%239 = load double, double* %1
%240 = fcmp oge double %239, 1.000000e-01
br i1 %240, label %241, label %258
241: ; preds = %238
%242 = load double, double* %1
%243 = fdiv double %242, 1.000000e-01
store double %243, double* %3
%244 = load i32, i32* %15
%245 = icmp eq i32 %244, 0
br i1 %245, label %246, label %251
246: ; preds = %241
%247 = load double, double* %3
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), double %247)
%249 = load i32, i32* %15
%250 = add nsw i32 %249, 1
store i32 %250, i32* %15
br label %254
251: ; preds = %241
%252 = load double, double* %3
%253 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i64 0, i64 0), double %252)
br label %254
254: ; preds = %251, %246
%255 = load double, double* %1
%256 = load double, double* %3
%257 = call double @llvm.fmuladd.f64(double -1.000000e-01, double %256, double %255)
store double %257, double* %1
br label %258
258: ; preds = %254, %238
%259 = load double, double* %1
%260 = fcmp oge double %259, 5.000000e-02
br i1 %260, label %261, label %278
261: ; preds = %258
%262 = load double, double* %1
%263 = fdiv double %262, 5.000000e-02
store double %263, double* %4
%264 = load i32, i32* %15
%265 = icmp eq i32 %264, 0
br i1 %265, label %266, label %271
266: ; preds = %261
%267 = load double, double* %4
%268 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0), double %267)
%269 = load i32, i32* %15
%270 = add nsw i32 %269, 1
store i32 %270, i32* %15
br label %274
271: ; preds = %261
%272 = load double, double* %4
%273 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), double %272)
br label %274
274: ; preds = %271, %266
%275 = load double, double* %1
%276 = load double, double* %4
%277 = call double @llvm.fmuladd.f64(double -5.000000e-02, double %276, double %275)
store double %277, double* %1
br label %278
278: ; preds = %274, %258
%279 = load double, double* %1
%280 = fcmp oge double %279, 1.000000e-02
br i1 %280, label %281, label %296
281: ; preds = %278
%282 = load double, double* %1
%283 = fdiv double %282, 1.000000e-02
store double %283, double* %5
%284 = load i32, i32* %15
%285 = icmp eq i32 %284, 0
br i1 %285, label %286, label %289
286: ; preds = %281
%287 = load double, double* %5
%288 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.27, i64 0, i64 0), double %287)
br label %292
289: ; preds = %281
%290 = load double, double* %5
%291 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0), double %290)
br label %292
292: ; preds = %289, %286
%293 = load double, double* %1
%294 = load double, double* %5
%295 = call double @llvm.fmuladd.f64(double -1.000000e-02, double %294, double %293)
store double %295, double* %1
br label %296
296: ; preds = %292, %278
%297 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.29, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Enter a peso amount: \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [24 x i8] c"The output is: %.2lf = \00"
@.str.4 = [11 x i8] c"(%d) 1000 \00"
@.str.5 = [10 x i8] c"(%d) 500 \00"
@.str.6 = [12 x i8] c"+ (%d) 500 \00"
@.str.7 = [10 x i8] c"(%d) 200 \00"
@.str.8 = [12 x i8] c"+ (%d) 200 \00"
@.str.9 = [9 x i8] c"(%d) 100\00"
@.str.10 = [12 x i8] c"+ (%d) 100 \00"
@.str.11 = [9 x i8] c"(%d) 50 \00"
@.str.12 = [11 x i8] c"+ (%d) 50 \00"
@.str.13 = [9 x i8] c"(%d) 20 \00"
@.str.14 = [11 x i8] c"+ (%d) 20 \00"
@.str.15 = [9 x i8] c"(%d) 10 \00"
@.str.16 = [11 x i8] c"+ (%d) 10 \00"
@.str.17 = [8 x i8] c"(%d) 5 \00"
@.str.18 = [10 x i8] c"+ (%d) 5 \00"
@.str.19 = [8 x i8] c"(%d) 1 \00"
@.str.20 = [10 x i8] c"+ (%d) 1 \00"
@.str.21 = [14 x i8] c"(%.0lf) 0.25 \00"
@.str.22 = [16 x i8] c"+ (%.0lf) 0.25 \00"
@.str.23 = [14 x i8] c"(%.0lf) 0.10 \00"
@.str.24 = [16 x i8] c"+ (%.0lf) 0.10 \00"
@.str.25 = [14 x i8] c"(%.0lf) 0.05 \00"
@.str.26 = [16 x i8] c"+ (%.0lf) 0.05 \00"
@.str.27 = [14 x i8] c"(%.0lf) 0.01 \00"
@.str.28 = [16 x i8] c"+ (%.0lf) 0.01 \00"
@str = [122 x i8] c"Problem 12: Given a peso amount, print out its equivalent standard peso currency using the least number of denominations.\00"
define void @Problem12() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([122 x i8], [122 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%6 = load double, double* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %6)
%8 = load double, double* %1
%9 = fcmp ult double %8, 1.000000e+03
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = fcmp ult double %8, 5.000000e+02
br i1 %11, label %38, label %21
12: ; preds = %0
%13 = fptosi double %8 to i32
%14 = sdiv i32 %13, 1000
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = load double, double* %1
%17 = mul nsw i32 %14, 1000
%18 = sitofp i32 %17 to double
%19 = fsub double %16, %18
store double %19, double* %1
%20 = fcmp ult double %19, 5.000000e+02
br i1 %20, label %35, label %25
21: ; preds = %10
%22 = fptosi double %8 to i32
%23 = sdiv i32 %22, 500
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %23)
br label %29
25: ; preds = %12
%26 = fptosi double %19 to i32
%27 = sdiv i32 %26, 500
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25, %21
%30 = phi i32 [ %27, %25 ], [ %23, %21 ]
%31 = load double, double* %1
%32 = mul nsw i32 %30, 500
%33 = sitofp i32 %32 to double
%34 = fsub double %31, %33
store double %34, double* %1
br label %35
35: ; preds = %12, %29
%36 = phi double [ %19, %12 ], [ %34, %29 ]
%37 = fcmp ult double %36, 2.000000e+02
br i1 %37, label %50, label %44
38: ; preds = %10
%39 = fcmp ult double %8, 2.000000e+02
br i1 %39, label %48, label %40
40: ; preds = %38
%41 = fptosi double %8 to i32
%42 = sdiv i32 %41, 200
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %42)
br label %52
44: ; preds = %35
%45 = fptosi double %36 to i32
%46 = sdiv i32 %45, 200
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %46)
br label %52
48: ; preds = %38
%49 = fcmp ult double %8, 1.000000e+02
br i1 %49, label %77, label %59
50: ; preds = %35
%51 = fcmp ult double %36, 1.000000e+02
br i1 %51, label %74, label %63
52: ; preds = %40, %44
%53 = phi i32 [ %46, %44 ], [ %42, %40 ]
%54 = load double, double* %1
%55 = mul nsw i32 %53, 200
%56 = sitofp i32 %55 to double
%57 = fsub double %54, %56
store double %57, double* %1
%58 = fcmp ult double %57, 1.000000e+02
br i1 %58, label %74, label %63
59: ; preds = %48
%60 = fptosi double %8 to i32
%61 = sdiv i32 %60, 100
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 %61)
br label %68
63: ; preds = %52, %50
%64 = phi double [ %36, %50 ], [ %57, %52 ]
%65 = fptosi double %64 to i32
%66 = sdiv i32 %65, 100
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %63, %59
%69 = phi i32 [ %66, %63 ], [ %61, %59 ]
%70 = load double, double* %1
%71 = mul nsw i32 %69, 100
%72 = sitofp i32 %71 to double
%73 = fsub double %70, %72
store double %73, double* %1
br label %74
74: ; preds = %50, %52, %68
%75 = phi double [ %57, %52 ], [ %73, %68 ], [ %36, %50 ]
%76 = fcmp ult double %75, 5.000000e+01
br i1 %76, label %89, label %83
77: ; preds = %48
%78 = fcmp ult double %8, 5.000000e+01
br i1 %78, label %87, label %79
79: ; preds = %77
%80 = fptosi double %8 to i32
%81 = sdiv i32 %80, 50
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %81)
br label %91
83: ; preds = %74
%84 = fptosi double %75 to i32
%85 = sdiv i32 %84, 50
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %85)
br label %91
87: ; preds = %77
%88 = fcmp ult double %8, 2.000000e+01
br i1 %88, label %116, label %98
89: ; preds = %74
%90 = fcmp ult double %75, 2.000000e+01
br i1 %90, label %113, label %102
91: ; preds = %79, %83
%92 = phi i32 [ %81, %79 ], [ %85, %83 ]
%93 = load double, double* %1
%94 = mul nsw i32 %92, 50
%95 = sitofp i32 %94 to double
%96 = fsub double %93, %95
store double %96, double* %1
%97 = fcmp ult double %96, 2.000000e+01
br i1 %97, label %113, label %102
98: ; preds = %87
%99 = fptosi double %8 to i32
%100 = sdiv i32 %99, 20
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i32 %100)
br label %107
102: ; preds = %91, %89
%103 = phi double [ %75, %89 ], [ %96, %91 ]
%104 = fptosi double %103 to i32
%105 = sdiv i32 %104, 20
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 %105)
br label %107
107: ; preds = %102, %98
%108 = phi i32 [ %105, %102 ], [ %100, %98 ]
%109 = load double, double* %1
%110 = mul nsw i32 %108, 20
%111 = sitofp i32 %110 to double
%112 = fsub double %109, %111
store double %112, double* %1
br label %113
113: ; preds = %89, %91, %107
%114 = phi double [ %96, %91 ], [ %112, %107 ], [ %75, %89 ]
%115 = fcmp ult double %114, 1.000000e+01
br i1 %115, label %128, label %122
116: ; preds = %87
%117 = fcmp ult double %8, 1.000000e+01
br i1 %117, label %126, label %118
118: ; preds = %116
%119 = fptosi double %8 to i32
%120 = sdiv i32 %119, 10
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i32 %120)
br label %130
122: ; preds = %113
%123 = fptosi double %114 to i32
%124 = sdiv i32 %123, 10
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %124)
br label %130
126: ; preds = %116
%127 = fcmp ult double %8, 5.000000e+00
br i1 %127, label %155, label %137
128: ; preds = %113
%129 = fcmp ult double %114, 5.000000e+00
br i1 %129, label %152, label %141
130: ; preds = %118, %122
%131 = phi i32 [ %120, %118 ], [ %124, %122 ]
%132 = load double, double* %1
%133 = mul nsw i32 %131, 10
%134 = sitofp i32 %133 to double
%135 = fsub double %132, %134
store double %135, double* %1
%136 = fcmp ult double %135, 5.000000e+00
br i1 %136, label %152, label %141
137: ; preds = %126
%138 = fptosi double %8 to i32
%139 = sdiv i32 %138, 5
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i32 %139)
br label %146
141: ; preds = %130, %128
%142 = phi double [ %114, %128 ], [ %135, %130 ]
%143 = fptosi double %142 to i32
%144 = sdiv i32 %143, 5
%145 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0), i32 %144)
br label %146
146: ; preds = %141, %137
%147 = phi i32 [ %144, %141 ], [ %139, %137 ]
%148 = load double, double* %1
%149 = mul nsw i32 %147, 5
%150 = sitofp i32 %149 to double
%151 = fsub double %148, %150
store double %151, double* %1
br label %152
152: ; preds = %128, %130, %146
%153 = phi double [ %135, %130 ], [ %151, %146 ], [ %114, %128 ]
%154 = fcmp ult double %153, 1.000000e+00
br i1 %154, label %165, label %160
155: ; preds = %126
%156 = fcmp ult double %8, 1.000000e+00
br i1 %156, label %163, label %157
157: ; preds = %155
%158 = fptosi double %8 to i32
%159 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i32 %158)
br label %167
160: ; preds = %152
%161 = fptosi double %153 to i32
%162 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i32 %161)
br label %167
163: ; preds = %155
%164 = fcmp ult double %8, 2.500000e-01
br i1 %164, label %187, label %173
165: ; preds = %152
%166 = fcmp ult double %153, 2.500000e-01
br i1 %166, label %184, label %176
167: ; preds = %157, %160
%168 = phi i32 [ %158, %157 ], [ %161, %160 ]
%169 = load double, double* %1
%170 = sitofp i32 %168 to double
%171 = fsub double %169, %170
store double %171, double* %1
%172 = fcmp ult double %171, 2.500000e-01
br i1 %172, label %184, label %176
173: ; preds = %163
%174 = fmul double %8, 4.000000e+00
%175 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0), double %174)
br label %180
176: ; preds = %167, %165
%177 = phi double [ %153, %165 ], [ %171, %167 ]
%178 = fmul double %177, 4.000000e+00
%179 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), double %178)
br label %180
180: ; preds = %176, %173
%181 = phi double [ %178, %176 ], [ %174, %173 ]
%182 = load double, double* %1
%183 = call double @llvm.fmuladd.f64(double %181, double -2.500000e-01, double %182)
store double %183, double* %1
br label %184
184: ; preds = %165, %167, %180
%185 = phi double [ %171, %167 ], [ %183, %180 ], [ %153, %165 ]
%186 = fcmp ult double %185, 1.000000e-01
br i1 %186, label %197, label %192
187: ; preds = %163
%188 = fcmp ult double %8, 1.000000e-01
br i1 %188, label %195, label %189
189: ; preds = %187
%190 = fdiv double %8, 1.000000e-01
%191 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), double %190)
br label %199
192: ; preds = %184
%193 = fdiv double %185, 1.000000e-01
%194 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i64 0, i64 0), double %193)
br label %199
195: ; preds = %187
%196 = fcmp ult double %8, 5.000000e-02
br i1 %196, label %218, label %204
197: ; preds = %184
%198 = fcmp ult double %185, 5.000000e-02
br i1 %198, label %215, label %207
199: ; preds = %189, %192
%200 = phi double [ %190, %189 ], [ %193, %192 ]
%201 = load double, double* %1
%202 = call double @llvm.fmuladd.f64(double %200, double -1.000000e-01, double %201)
store double %202, double* %1
%203 = fcmp ult double %202, 5.000000e-02
br i1 %203, label %215, label %207
204: ; preds = %195
%205 = fdiv double %8, 5.000000e-02
%206 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0), double %205)
br label %211
207: ; preds = %199, %197
%208 = phi double [ %185, %197 ], [ %202, %199 ]
%209 = fdiv double %208, 5.000000e-02
%210 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), double %209)
br label %211
211: ; preds = %207, %204
%212 = phi double [ %209, %207 ], [ %205, %204 ]
%213 = load double, double* %1
%214 = call double @llvm.fmuladd.f64(double %212, double -5.000000e-02, double %213)
store double %214, double* %1
br label %215
215: ; preds = %197, %199, %211
%216 = phi double [ %202, %199 ], [ %214, %211 ], [ %185, %197 ]
%217 = fcmp ult double %216, 1.000000e-02
br i1 %217, label %230, label %223
218: ; preds = %195
%219 = fcmp ult double %8, 1.000000e-02
br i1 %219, label %230, label %220
220: ; preds = %218
%221 = fdiv double %8, 1.000000e-02
%222 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.27, i64 0, i64 0), double %221)
br label %226
223: ; preds = %215
%224 = fdiv double %216, 1.000000e-02
%225 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0), double %224)
br label %226
226: ; preds = %223, %220
%227 = phi double [ %224, %223 ], [ %221, %220 ]
%228 = load double, double* %1
%229 = call double @llvm.fmuladd.f64(double %227, double -1.000000e-02, double %228)
store double %229, double* %1
br label %230
230: ; preds = %218, %226, %215
%231 = call i32 @putchar(i32 10)
ret void
}