#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 quant_v, quant_c, mes;
  float pm_v, pm_c, dif;
  do {
    printf("entre com o numero de vacas (minimo de duas): ");
    scanf("%d", &quant_v);
  } while (quant_v < 2);
  do {
    printf("entre com o numero de cabras (menor que o de vacas): ");
    scanf("%d", &quant_c);
  } while (quant_c > quant_v);
  pm_v = quant_v * 840;
  pm_c = quant_c * 150;
  for (mes = 0; pm_c < pm_v; mes++) {
    pm_v = pm_v + 840;
    pm_c = pm_c + (10 * 150);
  }
  dif = pm_c - pm_v;
  printf("%d mês para a produção mesal das cabras ultrapassar a das vacas.\n",
         mes);
  printf("A a diferença nesse mes é de %.2f kg de leite\n", dif);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jl     112f <main+0xf>
jmp    115c <main+0x3c>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     115c <main+0x3c>
imul   $0x348,-0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
imul   $0x96,-0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11f2 <main+0xd2>
movss  0xe3c(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe26(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ad <main+0x8d>
movss  -0x18(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%r14
lea    0xf00(%rip),%r15
lea    0x4(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x2,0x4(%rsp)
jl     1140 <main+0x20>
lea    0xed7(%rip),%r14
lea    0xecd(%rip),%r15
lea    0xc(%rsp),%rbx
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jg     1170 <main+0x50>
imul   $0x348,%ecx,%ecx
cvtsi2ss %ecx,%xmm0
imul   $0x96,%eax,%eax
cvtsi2ss %eax,%xmm3
xor    %esi,%esi
ucomiss %xmm3,%xmm0
jbe    11d0 <main+0xb0>
xor    %esi,%esi
movss  0xe4a(%rip),%xmm1
movss  0xe46(%rip),%xmm2
xchg   %ax,%ax
addss  %xmm1,%xmm0
addss  %xmm2,%xmm3
add    $0x1,%esi
ucomiss %xmm3,%xmm0
ja     11c0 <main+0xa0>
subss  %xmm0,%xmm3
movss  %xmm3,0x8(%rsp)
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"entre com o numero de vacas (minimo de duas): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [54 x i8] c"entre com o numero de cabras (menor que o de vacas): \00"
@.str.3 = [69 x i8] c"%d m\C3\AAs para a produ\C3\A7\C3\A3o mesal das cabras ultrapassar a das vacas.\0A\00"
@.str.4 = [49 x i8] c"A a diferen\C3\A7a nesse mes \C3\A9 de %.2f kg de leite\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
br label %8
8: ; preds = %11, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 2
br i1 %13, label %8, label %14
14: ; preds = %11
br label %15
15: ; preds = %18, %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = icmp sgt i32 %19, %20
br i1 %21, label %15, label %22
22: ; preds = %18
%23 = load i32, i32* %2
%24 = mul nsw i32 %23, 840
%25 = sitofp i32 %24 to float
store float %25, float* %5
%26 = load i32, i32* %3
%27 = mul nsw i32 %26, 150
%28 = sitofp i32 %27 to float
store float %28, float* %6
store i32 0, i32* %4
br label %29
29: ; preds = %38, %22
%30 = load float, float* %6
%31 = load float, float* %5
%32 = fcmp olt float %30, %31
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = load float, float* %5
%35 = fadd float %34, 8.400000e+02
store float %35, float* %5
%36 = load float, float* %6
%37 = fadd float %36, 1.500000e+03
store float %37, float* %6
br label %38
38: ; preds = %33
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %29
41: ; preds = %29
%42 = load float, float* %6
%43 = load float, float* %5
%44 = fsub float %42, %43
store float %44, float* %7
%45 = load i32, i32* %4
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0), i32 %45)
%47 = load float, float* %7
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"entre com o numero de vacas (minimo de duas): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [54 x i8] c"entre com o numero de cabras (menor que o de vacas): \00"
@.str.3 = [69 x i8] c"%d m\C3\AAs para a produ\C3\A7\C3\A3o mesal das cabras ultrapassar a das vacas.\0A\00"
@.str.4 = [49 x i8] c"A a diferen\C3\A7a nesse mes \C3\A9 de %.2f kg de leite\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 2
br i1 %9, label %5, label %10
10: ; preds = %5, %10
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = icmp sgt i32 %13, %14
br i1 %15, label %10, label %16
16: ; preds = %10
%17 = mul nsw i32 %14, 840
%18 = sitofp i32 %17 to float
%19 = mul nsw i32 %13, 150
%20 = sitofp i32 %19 to float
%21 = fcmp olt float %20, %18
br i1 %21, label %22, label %30
22: ; preds = %16, %22
%23 = phi i32 [ %28, %22 ], [ 0, %16 ]
%24 = phi float [ %27, %22 ], [ %20, %16 ]
%25 = phi float [ %26, %22 ], [ %18, %16 ]
%26 = fadd float %25, 8.400000e+02
%27 = fadd float %24, 1.500000e+03
%28 = add nuw nsw i32 %23, 1
%29 = fcmp olt float %27, %26
br i1 %29, label %22, label %30
30: ; preds = %22, %16
%31 = phi float [ %18, %16 ], [ %26, %22 ]
%32 = phi float [ %20, %16 ], [ %27, %22 ]
%33 = phi i32 [ 0, %16 ], [ %28, %22 ]
%34 = fsub float %32, %31
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%36 = fpext float %34 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), double %36)
ret i32 0
}