#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ sleep(int);
int main() {
  float x;
  float p;
  int a;
  float t;
  int y;
  printf("Qual produto você deseja?\nInsira:\n\t1-Coca-Cola           \tR$ "
         "3,50\n\t2-Smirnoff Ice        \tR$ 4,80\n\t3-Guaraná Antarctica \tR$ "
         "2,10\n\t4-Suco de Maracujá   \tR$ 1,90\n\t5-Cafezinho com Leite \tR$ "
         "0,70\n");
  a = getchar();
  switch (a) {
  case '1':
    printf("O valor da sua bebida e': %.2f\n", 3.50);
    p = 3.50;
    break;
  case '2':
    printf("O valor da sua bebida e': %.2f\n", 4.80);
    p = 4.80;
    break;
  case '3':
    printf("O valor da sua bebida e': %.2f\n", 2.10);
    p = 2.10;
    break;
  case '4':
    printf("O valor da sua bebida e': %.2f\n", 1.9);
    p = 1.9;
    break;
  case '5':
    printf("O valor da sua bebida e': %.2f\n", 0.70);
    p = 0.70;
    break;
  default:
    printf("Erro, Opção invalida\n");
    return 1;
  }
  printf("Você tem alguns segundos para colocar o dinheiro na maquina\n");
  sleep(2);
  printf("Digite o valor inserido\n");
  scanf("%f", &x);
  t = x - p;
  printf("Troco: %.2f\n", t);
  while (t > 0) {
    if (t >= 1.0) {
      while (t >= 1.0) {
        t = t - 1.0;
        y++;
      }
      printf("%d moedas de 1 real\n", y);
    } else if (t < 1.0 && t >= 0.50) {
      while (t < 1.0 && t >= 0.50) {
        t = t - 0.50;
        y = 0;
        y++;
      }
      printf("%d moedas de 50 centavos\n", y);
    } else if (t < 0.50 && t >= 0.25) {
      while (t < 0.50 && t >= 0.25) {
        t = t - 0.25;
        y = 0;
        y++;
      }
      printf("%d moedas de 25 centavos\n", y);
    }
    if (t < 0.25 && t >= 0.10) {
      while (t < 0.25 && t >= 0.10) {
        t = t - 0.10;
        y = 0;
        y++;
      }
      printf("%d moedas de 10 centavos\n", y);
    } else if (t < 0.10 && t >= 0.05) {
      while (t < 0.10 && t >= 0.05) {
        t = t - 0.05;
        y = 0;
        y++;
      }
      printf("%d moedas de 5 centavos\n", y);
    } else if (t < 0.05 && t > 0) {
      while (t < 0.05 && t > 0) {
        t = t - 0.01;
        y = 0;
        y++;
      }
      printf("%d moedas de 1 centavos\n", y);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf2e(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x21(%rbp)
call   1030 <printf@plt>
mov    -0x21(%rbp),%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4,%eax
ja     125c <main+0x11c>
mov    -0x20(%rbp),%rax
lea    0xee5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfad(%rip),%rdi
movsd  0xe95(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe5e(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1276 <main+0x136>
lea    0xf85(%rip),%rdi
movsd  0xe65(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe32(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1276 <main+0x136>
lea    0xf5d(%rip),%rdi
movsd  0xe35(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe06(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1276 <main+0x136>
lea    0xf35(%rip),%rdi
movsd  0xe05(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xdda(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1276 <main+0x136>
lea    0xf0d(%rip),%rdi
movsd  0xdd5(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xdae(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1276 <main+0x136>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176d <main+0x62d>
lea    0xf03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf0f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1766 <main+0x626>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd4c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1360 <main+0x220>
jmp    1303 <main+0x1c3>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd2c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     134a <main+0x20a>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd11(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1303 <main+0x1c3>
mov    -0x18(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1503 <main+0x3c3>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xccf(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    142f <main+0x2ef>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcbc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     142f <main+0x2ef>
jmp    139b <main+0x25b>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xor    %eax,%eax
movsd  0xc92(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x22(%rbp)
jbe    13d6 <main+0x296>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    13e6 <main+0x2a6>
jmp    1419 <main+0x2d9>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc51(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    139b <main+0x25b>
mov    -0x18(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14fe <main+0x3be>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc08(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    14f9 <main+0x3b9>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbf5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     14f9 <main+0x3b9>
jmp    146a <main+0x32a>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xor    %eax,%eax
movsd  0xbcb(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x23(%rbp)
jbe    14a5 <main+0x365>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
test   $0x1,%al
jne    14b5 <main+0x375>
jmp    14e8 <main+0x3a8>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb8a(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    146a <main+0x32a>
mov    -0x18(%rbp),%esi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14fe <main+0x3be>
jmp    1503 <main+0x3c3>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xb3c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    15d2 <main+0x492>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb29(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     15d2 <main+0x492>
jmp    153e <main+0x3fe>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xor    %eax,%eax
movsd  0xaff(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x24(%rbp)
jbe    1579 <main+0x439>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xae9(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x24(%rbp)
mov    -0x24(%rbp),%al
test   $0x1,%al
jne    1589 <main+0x449>
jmp    15bc <main+0x47c>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xabe(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    153e <main+0x3fe>
mov    -0x18(%rbp),%esi
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1761 <main+0x621>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xa75(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    16a1 <main+0x561>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xa62(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     16a1 <main+0x561>
jmp    160d <main+0x4cd>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xor    %eax,%eax
movsd  0xa38(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x25(%rbp)
jbe    1648 <main+0x508>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xa22(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1658 <main+0x518>
jmp    168b <main+0x54b>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x9f7(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    160d <main+0x4cd>
mov    -0x18(%rbp),%esi
lea    0xbb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    175c <main+0x61c>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x9ae(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1757 <main+0x617>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1757 <main+0x617>
jmp    16d2 <main+0x592>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xor    %eax,%eax
movsd  0x97b(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x26(%rbp)
jbe    1703 <main+0x5c3>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
test   $0x1,%al
jne    1713 <main+0x5d3>
jmp    1746 <main+0x606>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x944(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    16d2 <main+0x592>
mov    -0x18(%rbp),%esi
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    175c <main+0x61c>
jmp    1761 <main+0x621>
jmp    12d2 <main+0x192>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xfa3(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
add    $0xffffffcf,%eax
cmp    $0x5,%eax
jae    149a <main+0x34a>
movslq %eax,%rbp
lea    0x10b2(%rip),%rax
movsd  (%rax,%rbp,8),%xmm0
lea    0x10ce(%rip),%r14
lea    0xea7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0x1021(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
lea    0x1048(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
subss  (%r14,%rbp,4),%xmm0
movss  %xmm0,(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm2
jbe    14af <main+0x35f>
movss  0xdf1(%rip),%xmm0
movss  0xdf9(%rip),%xmm3
lea    0xe67(%rip),%r15
movsd  0xdf2(%rip),%xmm4
lea    0xebf(%rip),%r12
lea    0xe9f(%rip),%r13
lea    0xe7e(%rip),%r14
lea    0xe2e(%rip),%rbx
jmp    1292 <main+0x142>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  %xmm1,(%rsp)
mov    %r14,%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
movss  (%rsp),%xmm2
movss  0xd97(%rip),%xmm3
movsd  0xd97(%rip),%xmm4
ucomiss %xmm1,%xmm2
movss  0xd74(%rip),%xmm0
jbe    14ad <main+0x35d>
ucomiss %xmm0,%xmm2
jae    12e0 <main+0x190>
ucomiss %xmm2,%xmm0
jbe    13d0 <main+0x280>
ucomiss 0xd61(%rip),%xmm2
jb     13d0 <main+0x280>
movss  0xd53(%rip),%xmm1
movss  0xd4f(%rip),%xmm3
nopl   (%rax)
addss  %xmm3,%xmm2
ucomiss %xmm2,%xmm0
jbe    12ce <main+0x17e>
ucomiss %xmm1,%xmm2
jae    12c0 <main+0x170>
mov    $0x1,%ebp
mov    %r15,%rdi
mov    $0x1,%esi
jmp    1301 <main+0x1b1>
nopl   (%rax)
movss  0xd1c(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
addss  %xmm1,%xmm2
add    $0x1,%ebp
ucomiss %xmm0,%xmm2
jae    12f0 <main+0x1a0>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
movss  %xmm2,(%rsp)
call   1040 <printf@plt>
movss  (%rsp),%xmm2
xorps  %xmm1,%xmm1
movss  0xcf3(%rip),%xmm3
movsd  0xcf3(%rip),%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
ucomiss %xmm2,%xmm3
jbe    1370 <main+0x220>
ucomisd %xmm4,%xmm0
jb     1370 <main+0x220>
movsd  0xce1(%rip),%xmm2
nop
addsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
ucomiss %xmm1,%xmm3
jbe    1250 <main+0x100>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
ucomisd %xmm4,%xmm0
jae    1340 <main+0x1f0>
jmp    1250 <main+0x100>
cs nopw 0x0(%rax,%rax,1)
ucomisd %xmm0,%xmm4
jbe    1440 <main+0x2f0>
ucomisd 0xca6(%rip),%xmm0
jb     1440 <main+0x2f0>
movsd  0xc98(%rip),%xmm2
movsd  0xc98(%rip),%xmm3
nopl   0x0(%rax,%rax,1)
addsd  %xmm3,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
ucomisd %xmm0,%xmm4
jbe    13be <main+0x26e>
ucomisd %xmm2,%xmm0
jae    13a0 <main+0x250>
movss  %xmm1,(%rsp)
mov    %r13,%rdi
jmp    1258 <main+0x108>
nopl   0x0(%rax,%rax,1)
movss  0xc30(%rip),%xmm0
ucomiss %xmm2,%xmm0
jbe    1325 <main+0x1d5>
ucomiss %xmm3,%xmm2
jb     1325 <main+0x1d5>
movss  0xc16(%rip),%xmm0
movss  0xc1a(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
addss  %xmm1,%xmm2
ucomiss %xmm2,%xmm0
jbe    140e <main+0x2be>
ucomiss %xmm3,%xmm2
jae    1400 <main+0x2b0>
mov    $0x1,%ebp
lea    0xc85(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
movss  %xmm2,(%rsp)
call   1040 <printf@plt>
movss  0xbdd(%rip),%xmm3
movss  (%rsp),%xmm2
xorps  %xmm1,%xmm1
jmp    131d <main+0x1cd>
ucomiss %xmm1,%xmm2
jbe    1281 <main+0x131>
movsd  0xbd7(%rip),%xmm5
ucomisd %xmm0,%xmm5
jbe    1281 <main+0x131>
movsd  0xbc5(%rip),%xmm3
movsd  0xbcd(%rip),%xmm4
nopl   0x0(%rax,%rax,1)
addsd  %xmm4,%xmm0
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
ucomiss %xmm1,%xmm2
jbe    148d <main+0x33d>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
ucomisd %xmm0,%xmm3
ja     1470 <main+0x320>
movss  %xmm2,(%rsp)
mov    %r12,%rdi
jmp    1258 <main+0x108>
lea    0xd7c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    14af <main+0x35f>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [196 x i8] c"Qual produto voc\C3\AA deseja?\0AInsira:\0A\091-Coca-Cola \09R$ 3,50\0A\092-Smirnoff Ice \09R$ 4,80\0A\093-Guaran\C3\A1 Antarctica \09R$ 2,10\0A\094-Suco de Maracuj\C3\A1 \09R$ 1,90\0A\095-Cafezinho com Leite \09R$ 0,70\0A\00"
@.str.1 = [32 x i8] c"O valor da sua bebida e': %.2f\0A\00"
@.str.2 = [24 x i8] c"Erro, Op\C3\A7\C3\A3o invalida\0A\00"
@.str.3 = [62 x i8] c"Voc\C3\AA tem alguns segundos para colocar o dinheiro na maquina\0A\00"
@.str.4 = [25 x i8] c"Digite o valor inserido\0A\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [13 x i8] c"Troco: %.2f\0A\00"
@.str.7 = [21 x i8] c"%d moedas de 1 real\0A\00"
@.str.8 = [26 x i8] c"%d moedas de 50 centavos\0A\00"
@.str.9 = [26 x i8] c"%d moedas de 25 centavos\0A\00"
@.str.10 = [26 x i8] c"%d moedas de 10 centavos\0A\00"
@.str.11 = [25 x i8] c"%d moedas de 5 centavos\0A\00"
@.str.12 = [25 x i8] c"%d moedas de 1 centavos\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @getchar()
store i32 %8, i32* %4
%9 = load i32, i32* %4
switch i32 %9, label %20 [
i32 49, label %10
i32 50, label %12
i32 51, label %14
i32 52, label %16
i32 53, label %18
]
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double 3.500000e+00)
store float 3.500000e+00, float* %3
br label %22
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double 4.800000e+00)
store float 0x4013333340000000, float* %3
br label %22
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double 2.100000e+00)
store float 0x4000CCCCC0000000, float* %3
br label %22
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double 1.900000e+00)
store float 0x3FFE666660000000, float* %3
br label %22
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double 0x3FE6666666666666)
store float 0x3FE6666660000000, float* %3
br label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %204
22: ; preds = %18, %16, %14, %12, %10
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @sleep(i32 2)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %2)
%27 = load float, float* %2
%28 = load float, float* %3
%29 = fsub float %27, %28
store float %29, float* %5
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %31)
br label %33
33: ; preds = %202, %22
%34 = load float, float* %5
%35 = fcmp ogt float %34, 0.000000e+00
br i1 %35, label %36, label %203
36: ; preds = %33
%37 = load float, float* %5
%38 = fpext float %37 to double
%39 = fcmp oge double %38, 1.000000e+00
br i1 %39, label %40, label %55
40: ; preds = %36
br label %41
41: ; preds = %45, %40
%42 = load float, float* %5
%43 = fpext float %42 to double
%44 = fcmp oge double %43, 1.000000e+00
br i1 %44, label %45, label %52
45: ; preds = %41
%46 = load float, float* %5
%47 = fpext float %46 to double
%48 = fsub double %47, 1.000000e+00
%49 = fptrunc double %48 to float
store float %49, float* %5
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %41
52: ; preds = %41
%53 = load i32, i32* %6
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %53)
br label %115
55: ; preds = %36
%56 = load float, float* %5
%57 = fpext float %56 to double
%58 = fcmp olt double %57, 1.000000e+00
br i1 %58, label %59, label %84
59: ; preds = %55
%60 = load float, float* %5
%61 = fpext float %60 to double
%62 = fcmp oge double %61, 5.000000e-01
br i1 %62, label %63, label %84
63: ; preds = %59
br label %64
64: ; preds = %74, %63
%65 = load float, float* %5
%66 = fpext float %65 to double
%67 = fcmp olt double %66, 1.000000e+00
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = load float, float* %5
%70 = fpext float %69 to double
%71 = fcmp oge double %70, 5.000000e-01
br label %72
72: ; preds = %68, %64
%73 = phi i1 [ false, %64 ], [ %71, %68 ]
br i1 %73, label %74, label %81
74: ; preds = %72
%75 = load float, float* %5
%76 = fpext float %75 to double
%77 = fsub double %76, 5.000000e-01
%78 = fptrunc double %77 to float
store float %78, float* %5
store i32 0, i32* %6
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %64
81: ; preds = %72
%82 = load i32, i32* %6
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %82)
br label %114
84: ; preds = %59, %55
%85 = load float, float* %5
%86 = fpext float %85 to double
%87 = fcmp olt double %86, 5.000000e-01
br i1 %87, label %88, label %113
88: ; preds = %84
%89 = load float, float* %5
%90 = fpext float %89 to double
%91 = fcmp oge double %90, 2.500000e-01
br i1 %91, label %92, label %113
92: ; preds = %88
br label %93
93: ; preds = %103, %92
%94 = load float, float* %5
%95 = fpext float %94 to double
%96 = fcmp olt double %95, 5.000000e-01
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = load float, float* %5
%99 = fpext float %98 to double
%100 = fcmp oge double %99, 2.500000e-01
br label %101
101: ; preds = %97, %93
%102 = phi i1 [ false, %93 ], [ %100, %97 ]
br i1 %102, label %103, label %110
103: ; preds = %101
%104 = load float, float* %5
%105 = fpext float %104 to double
%106 = fsub double %105, 2.500000e-01
%107 = fptrunc double %106 to float
store float %107, float* %5
store i32 0, i32* %6
%108 = load i32, i32* %6
%109 = add nsw i32 %108, 1
store i32 %109, i32* %6
br label %93
110: ; preds = %101
%111 = load i32, i32* %6
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %110, %88, %84
br label %114
114: ; preds = %113, %81
br label %115
115: ; preds = %114, %52
%116 = load float, float* %5
%117 = fpext float %116 to double
%118 = fcmp olt double %117, 2.500000e-01
br i1 %118, label %119, label %144
119: ; preds = %115
%120 = load float, float* %5
%121 = fpext float %120 to double
%122 = fcmp oge double %121, 1.000000e-01
br i1 %122, label %123, label %144
123: ; preds = %119
br label %124
124: ; preds = %134, %123
%125 = load float, float* %5
%126 = fpext float %125 to double
%127 = fcmp olt double %126, 2.500000e-01
br i1 %127, label %128, label %132
128: ; preds = %124
%129 = load float, float* %5
%130 = fpext float %129 to double
%131 = fcmp oge double %130, 1.000000e-01
br label %132
132: ; preds = %128, %124
%133 = phi i1 [ false, %124 ], [ %131, %128 ]
br i1 %133, label %134, label %141
134: ; preds = %132
%135 = load float, float* %5
%136 = fpext float %135 to double
%137 = fsub double %136, 1.000000e-01
%138 = fptrunc double %137 to float
store float %138, float* %5
store i32 0, i32* %6
%139 = load i32, i32* %6
%140 = add nsw i32 %139, 1
store i32 %140, i32* %6
br label %124
141: ; preds = %132
%142 = load i32, i32* %6
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %142)
br label %202
144: ; preds = %119, %115
%145 = load float, float* %5
%146 = fpext float %145 to double
%147 = fcmp olt double %146, 1.000000e-01
br i1 %147, label %148, label %173
148: ; preds = %144
%149 = load float, float* %5
%150 = fpext float %149 to double
%151 = fcmp oge double %150, 5.000000e-02
br i1 %151, label %152, label %173
152: ; preds = %148
br label %153
153: ; preds = %163, %152
%154 = load float, float* %5
%155 = fpext float %154 to double
%156 = fcmp olt double %155, 1.000000e-01
br i1 %156, label %157, label %161
157: ; preds = %153
%158 = load float, float* %5
%159 = fpext float %158 to double
%160 = fcmp oge double %159, 5.000000e-02
br label %161
161: ; preds = %157, %153
%162 = phi i1 [ false, %153 ], [ %160, %157 ]
br i1 %162, label %163, label %170
163: ; preds = %161
%164 = load float, float* %5
%165 = fpext float %164 to double
%166 = fsub double %165, 5.000000e-02
%167 = fptrunc double %166 to float
store float %167, float* %5
store i32 0, i32* %6
%168 = load i32, i32* %6
%169 = add nsw i32 %168, 1
store i32 %169, i32* %6
br label %153
170: ; preds = %161
%171 = load i32, i32* %6
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %171)
br label %201
173: ; preds = %148, %144
%174 = load float, float* %5
%175 = fpext float %174 to double
%176 = fcmp olt double %175, 5.000000e-02
br i1 %176, label %177, label %200
177: ; preds = %173
%178 = load float, float* %5
%179 = fcmp ogt float %178, 0.000000e+00
br i1 %179, label %180, label %200
180: ; preds = %177
br label %181
181: ; preds = %190, %180
%182 = load float, float* %5
%183 = fpext float %182 to double
%184 = fcmp olt double %183, 5.000000e-02
br i1 %184, label %185, label %188
185: ; preds = %181
%186 = load float, float* %5
%187 = fcmp ogt float %186, 0.000000e+00
br label %188
188: ; preds = %185, %181
%189 = phi i1 [ false, %181 ], [ %187, %185 ]
br i1 %189, label %190, label %197
190: ; preds = %188
%191 = load float, float* %5
%192 = fpext float %191 to double
%193 = fsub double %192, 1.000000e-02
%194 = fptrunc double %193 to float
store float %194, float* %5
store i32 0, i32* %6
%195 = load i32, i32* %6
%196 = add nsw i32 %195, 1
store i32 %196, i32* %6
br label %181
197: ; preds = %188
%198 = load i32, i32* %6
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i32 %198)
br label %200
200: ; preds = %197, %177, %173
br label %201
201: ; preds = %200, %170
br label %202
202: ; preds = %201, %141
br label %33
203: ; preds = %33
store i32 0, i32* %1
br label %204
204: ; preds = %203, %20
%205 = load i32, i32* %1
ret i32 %205
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"O valor da sua bebida e': %.2f\0A\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [13 x i8] c"Troco: %.2f\0A\00"
@.str.7 = [21 x i8] c"%d moedas de 1 real\0A\00"
@.str.8 = [26 x i8] c"%d moedas de 50 centavos\0A\00"
@.str.9 = [26 x i8] c"%d moedas de 25 centavos\0A\00"
@.str.10 = [26 x i8] c"%d moedas de 10 centavos\0A\00"
@.str.11 = [25 x i8] c"%d moedas de 5 centavos\0A\00"
@.str.12 = [25 x i8] c"%d moedas de 1 centavos\0A\00"
@str = [195 x i8] c"Qual produto voc\C3\AA deseja?\0AInsira:\0A\091-Coca-Cola \09R$ 3,50\0A\092-Smirnoff Ice \09R$ 4,80\0A\093-Guaran\C3\A1 Antarctica \09R$ 2,10\0A\094-Suco de Maracuj\C3\A1 \09R$ 1,90\0A\095-Cafezinho com Leite \09R$ 0,70\00"
@str.13 = [61 x i8] c"Voc\C3\AA tem alguns segundos para colocar o dinheiro na maquina\00"
@str.14 = [24 x i8] c"Digite o valor inserido\00"
@str.15 = [23 x i8] c"Erro, Op\C3\A7\C3\A3o invalida\00"
@switch.table.main = [5 x double] [double 3.500000e+00, double 4.800000e+00, double 2.100000e+00, double 1.900000e+00, double 0x3FE6666666666666]
@switch.table.main.16 = [5 x float] [float 3.500000e+00, float 0x4013333340000000, float 0x4000CCCCC0000000, float 0x3FFE666660000000, float 0x3FE6666660000000]
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([195 x i8], [195 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
%5 = add i32 %4, -49
%6 = icmp ult i32 %5, 5
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
br label %109
9: ; preds = %0
%10 = sext i32 %5 to i64
%11 = getelementptr inbounds [5 x double], [5 x double]* @switch.table.main, i64 0, i64 %10
%12 = load double, double* %11
%13 = sext i32 %5 to i64
%14 = getelementptr inbounds [5 x float], [5 x float]* @switch.table.main.16, i64 0, i64 %13
%15 = load float, float* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double %12)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.13, i64 0, i64 0))
%18 = tail call i32 @sleep(i32 2)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %1)
%21 = load float, float* %1
%22 = fsub float %21, %15
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %23)
%25 = fcmp ogt float %22, 0.000000e+00
br i1 %25, label %26, label %109
26: ; preds = %9, %105
%27 = phi i32 [ %107, %105 ], [ undef, %9 ]
%28 = phi float [ %106, %105 ], [ %22, %9 ]
%29 = fcmp ult float %28, 1.000000e+00
br i1 %29, label %38, label %30
30: ; preds = %26, %30
%31 = phi i32 [ %34, %30 ], [ %27, %26 ]
%32 = phi float [ %33, %30 ], [ %28, %26 ]
%33 = fadd float %32, -1.000000e+00
%34 = add nsw i32 %31, 1
%35 = fcmp ult float %33, 1.000000e+00
br i1 %35, label %36, label %30
36: ; preds = %30
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %34)
br label %62
38: ; preds = %26
%39 = fcmp uge float %28, 1.000000e+00
%40 = fcmp ult float %28, 5.000000e-01
%41 = or i1 %39, %40
br i1 %41, label %50, label %42
42: ; preds = %38, %42
%43 = phi float [ %44, %42 ], [ %28, %38 ]
%44 = fadd float %43, -5.000000e-01
%45 = fcmp olt float %44, 1.000000e+00
%46 = fcmp oge float %44, 5.000000e-01
%47 = and i1 %45, %46
br i1 %47, label %42, label %48
48: ; preds = %42
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 1)
br label %62
50: ; preds = %38
%51 = fcmp uge float %28, 5.000000e-01
%52 = fcmp ult float %28, 2.500000e-01
%53 = or i1 %51, %52
br i1 %53, label %62, label %54
54: ; preds = %50, %54
%55 = phi float [ %56, %54 ], [ %28, %50 ]
%56 = fadd float %55, -2.500000e-01
%57 = fcmp olt float %56, 5.000000e-01
%58 = fcmp oge float %56, 2.500000e-01
%59 = and i1 %57, %58
br i1 %59, label %54, label %60
60: ; preds = %54
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 1)
br label %62
62: ; preds = %48, %60, %50, %36
%63 = phi float [ %33, %36 ], [ %44, %48 ], [ %56, %60 ], [ %28, %50 ]
%64 = phi i32 [ %34, %36 ], [ 1, %48 ], [ 1, %60 ], [ %27, %50 ]
%65 = fpext float %63 to double
%66 = fcmp uge float %63, 2.500000e-01
%67 = fcmp ult double %65, 1.000000e-01
%68 = or i1 %66, %67
br i1 %68, label %77, label %69
69: ; preds = %62, %69
%70 = phi double [ %73, %69 ], [ %65, %62 ]
%71 = fadd double %70, -1.000000e-01
%72 = fptrunc double %71 to float
%73 = fpext float %72 to double
%74 = fcmp olt float %72, 2.500000e-01
%75 = fcmp oge double %73, 1.000000e-01
%76 = and i1 %74, %75
br i1 %76, label %69, label %101
77: ; preds = %62
%78 = fcmp uge double %65, 1.000000e-01
%79 = fcmp ult double %65, 5.000000e-02
%80 = or i1 %78, %79
br i1 %80, label %89, label %81
81: ; preds = %77, %81
%82 = phi double [ %85, %81 ], [ %65, %77 ]
%83 = fadd double %82, -5.000000e-02
%84 = fptrunc double %83 to float
%85 = fpext float %84 to double
%86 = fcmp olt double %85, 1.000000e-01
%87 = fcmp oge double %85, 5.000000e-02
%88 = and i1 %86, %87
br i1 %88, label %81, label %101
89: ; preds = %77
%90 = fcmp olt double %65, 5.000000e-02
%91 = fcmp ogt float %63, 0.000000e+00
%92 = and i1 %91, %90
br i1 %92, label %93, label %105
93: ; preds = %89, %93
%94 = phi double [ %97, %93 ], [ %65, %89 ]
%95 = fadd double %94, -1.000000e-02
%96 = fptrunc double %95 to float
%97 = fpext float %96 to double
%98 = fcmp olt double %97, 5.000000e-02
%99 = fcmp ogt float %96, 0.000000e+00
%100 = and i1 %99, %98
br i1 %100, label %93, label %101
101: ; preds = %69, %81, %93
%102 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), %93 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), %81 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), %69 ]
%103 = phi float [ %96, %93 ], [ %84, %81 ], [ %72, %69 ]
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %102, i32 1)
br label %105
105: ; preds = %101, %89
%106 = phi float [ %63, %89 ], [ %103, %101 ]
%107 = phi i32 [ %64, %89 ], [ 1, %101 ]
%108 = fcmp ogt float %106, 0.000000e+00
br i1 %108, label %26, label %109
109: ; preds = %105, %9, %7
%110 = phi i32 [ 1, %7 ], [ 0, %9 ], [ 0, %105 ]
ret i32 %110
}