#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);
int main(void) {
  int pA = 80000;
  int pB = 200000;
  int cA = 80000 * 3.0;
  int cB = 200000 * 1.5;
  int c = 0;
  while (pA <= pB) {
    pA += cA;
    pB += cB;
    c += 1;
  }
  printf("Ira levar %i anos para a população A alcançar a B\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x13880,-0x8(%rbp)
movl   $0x30d40,-0xc(%rbp)
movl   $0x3a980,-0x10(%rbp)
movl   $0x493e0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     116e <main+0x5e>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1142 <main+0x32>
mov    -0x18(%rbp),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x13880,%eax
xor    %esi,%esi
mov    $0x7a120,%ecx
nopl   0x0(%rax)
add    $0x3a980,%eax
add    $0x1,%esi
lea    0x493e0(%rcx),%edx
cmp    %ecx,%eax
mov    %edx,%ecx
jbe    1120 <main+0x10>
push   %rax
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Ira levar %i anos para a popula\C3\A7\C3\A3o A alcan\C3\A7ar a B\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 80000, i32* %2
store i32 200000, i32* %3
store i32 240000, i32* %4
store i32 300000, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = add nsw i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %7
20: ; preds = %7
%21 = load i32, i32* %6
%22 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [54 x i8] c"Ira levar %i anos para a popula\C3\A7\C3\A3o A alcan\C3\A7ar a B\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = phi i32 [ 80000, %0 ], [ %5, %1 ]
%4 = phi i32 [ 200000, %0 ], [ %6, %1 ]
%5 = add nuw nsw i32 %3, 240000
%6 = add nuw nsw i32 %4, 300000
%7 = add nuw nsw i32 %2, 1
%8 = icmp ugt i32 %5, %6
br i1 %8, label %9, label %1
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}