#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(void) {
  int casos, anos;
  int pa, pb;
  double ga, gb;
  scanf("%d\n", &casos);
  while (casos-- > 0) {
    scanf("%d %d %lf %lf\n", &pa, &pb, &ga, &gb);
    ga = ga / 100 + 1;
    gb = gb / 100 + 1;
    for (anos = 1; anos <= 100; anos++) {
      pa *= ga;
      pb *= gb;
      if (pa > pb) {
        printf("%d anos.\n", anos);
        break;
      }
    }
    if (anos > 100) {
      printf("Mais de 1 seculo.\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1244 <main+0x124>
lea    0xeb8(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  0xe88(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe74(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe52(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jg     1227 <main+0x107>
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1214 <main+0xf4>
mov    -0xc(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1227 <main+0x107>
jmp    1219 <main+0xf9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x9e>
cmpl   $0x64,-0xc(%rbp)
jle    123f <main+0x11f>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xedb(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    1273 <main+0x143>
lea    0xeb9(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0x20(%rsp),%r13
lea    0x18(%rsp),%rbx
lea    0xead(%rip),%rbp
jmp    11b8 <main+0x88>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%esi
mov    %eax,0x14(%rsp)
mov    %ecx,0x10(%rsp)
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    1273 <main+0x143>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x20(%rsp),%xmm0
movhpd 0x18(%rsp),%xmm0
divpd  0xe1e(%rip),%xmm0
addpd  0xe26(%rip),%xmm0
movlpd %xmm0,0x20(%rsp)
movhpd %xmm0,0x18(%rsp)
movss  0x10(%rsp),%xmm2
movss  0x14(%rsp),%xmm1
unpcklps %xmm2,%xmm1
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
cvtdq2pd %xmm1,%xmm1
mulpd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm1
movd   %xmm1,%eax
pshufd $0x55,%xmm1,%xmm2
movd   %xmm2,%ecx
cmp    %ecx,%eax
jg     1190 <main+0x60>
cvtdq2pd %xmm1,%xmm1
mulpd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm1
movd   %xmm1,%eax
pshufd $0x55,%xmm1,%xmm2
movd   %xmm2,%ecx
cmp    %ecx,%eax
jg     1193 <main+0x63>
add    $0x2,%esi
cmp    $0x66,%esi
jne    1210 <main+0xe0>
mov    %eax,0x14(%rsp)
mov    %ecx,0x10(%rsp)
lea    0xdd4(%rip),%rdi
call   1030 <puts@plt>
jmp    11a5 <main+0x75>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [15 x i8] c"%d %d %lf %lf\0A\00"
@.str.2 = [10 x i8] c"%d anos.\0A\00"
@.str.3 = [19 x i8] c"Mais de 1 seculo.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %50, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp sgt i32 %10, 0
br i1 %12, label %13, label %51
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, double* %6, double* %7)
%15 = load double, double* %6
%16 = fdiv double %15, 1.000000e+02
%17 = fadd double %16, 1.000000e+00
store double %17, double* %6
%18 = load double, double* %7
%19 = fdiv double %18, 1.000000e+02
%20 = fadd double %19, 1.000000e+00
store double %20, double* %7
store i32 1, i32* %3
br label %21
21: ; preds = %42, %13
%22 = load i32, i32* %3
%23 = icmp sle i32 %22, 100
br i1 %23, label %24, label %45
24: ; preds = %21
%25 = load double, double* %6
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to double
%28 = fmul double %27, %25
%29 = fptosi double %28 to i32
store i32 %29, i32* %4
%30 = load double, double* %7
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to double
%33 = fmul double %32, %30
%34 = fptosi double %33 to i32
store i32 %34, i32* %5
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = icmp sgt i32 %35, %36
br i1 %37, label %38, label %41
38: ; preds = %24
%39 = load i32, i32* %3
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %45
41: ; preds = %24
br label %42
42: ; preds = %41
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %21
45: ; preds = %38, %21
%46 = load i32, i32* %3
%47 = icmp sgt i32 %46, 100
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48, %45
br label %9
51: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [15 x i8] c"%d %d %lf %lf\0A\00"
@.str.2 = [10 x i8] c"%d anos.\0A\00"
@str = [18 x i8] c"Mais de 1 seculo.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = add nsw i32 %12, -1
store i32 %13, i32* %1
%14 = icmp sgt i32 %12, 0
br i1 %14, label %15, label %61
15: ; preds = %0, %57
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, double* %4, double* %5)
%17 = load double, double* %4
%18 = load double, double* %5
%19 = insertelement <2 x double> poison, double %17, i64 0
%20 = insertelement <2 x double> %19, double %18, i64 1
%21 = fdiv <2 x double> %20, <double 1.000000e+02, double 1.000000e+02>
%22 = fadd <2 x double> %21, <double 1.000000e+00, double 1.000000e+00>
%23 = extractelement <2 x double> %22, i64 0
store double %23, double* %4
%24 = extractelement <2 x double> %22, i64 1
store double %24, double* %5
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = insertelement <2 x i32> poison, i32 %25, i64 0
%28 = insertelement <2 x i32> %27, i32 %26, i64 1
br label %29
29: ; preds = %45, %15
%30 = phi i32 [ 1, %15 ], [ %46, %45 ]
%31 = phi <2 x i32> [ %28, %15 ], [ %41, %45 ]
%32 = sitofp <2 x i32> %31 to <2 x double>
%33 = fmul <2 x double> %22, %32
%34 = fptosi <2 x double> %33 to <2 x i32>
%35 = extractelement <2 x i32> %34, i64 0
%36 = extractelement <2 x i32> %34, i64 1
%37 = icmp sgt i32 %35, %36
br i1 %37, label %50, label %38
38: ; preds = %29
%39 = sitofp <2 x i32> %34 to <2 x double>
%40 = fmul <2 x double> %22, %39
%41 = fptosi <2 x double> %40 to <2 x i32>
%42 = extractelement <2 x i32> %41, i64 0
%43 = extractelement <2 x i32> %41, i64 1
%44 = icmp sgt i32 %42, %43
br i1 %44, label %48, label %45
45: ; preds = %38
%46 = add nuw nsw i32 %30, 2
%47 = icmp eq i32 %46, 101
br i1 %47, label %55, label %29
48: ; preds = %38
%49 = add nuw nsw i32 %30, 1
br label %50
50: ; preds = %29, %48
%51 = phi i32 [ %49, %48 ], [ %30, %29 ]
%52 = phi i32 [ %42, %48 ], [ %35, %29 ]
%53 = phi i32 [ %43, %48 ], [ %36, %29 ]
store i32 %52, i32* %2
store i32 %53, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %51)
br label %57
55: ; preds = %45
store i32 %42, i32* %2
store i32 %43, i32* %3
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %57
57: ; preds = %50, %55
%58 = load i32, i32* %1
%59 = add nsw i32 %58, -1
store i32 %59, i32* %1
%60 = icmp sgt i32 %58, 0
br i1 %60, label %15, label %61
61: ; preds = %57, %0
ret i32 0
}