#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ *abri_arquivo();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
double pow(float, int);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ vazio_arquivo(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  FILE *farq;
  char tipo = {'r', 't', 'c'};
  char c;
  float v[2] = {0, 0};
  float b = 0, h = 0, r = 0;
  farq = abri_arquivo();
  vazio_arquivo(farq);
  fseek(farq, 0, SEEK_SET);
  while (!feof(farq)) {
    c = fgetc(farq);
    fscanf(farq, "%f", &b);
    if (c == 'r') {
      fscanf(farq, "%f", &h);
      if ((b * h) > v[0])
        v[0] = b * h;
    } else if (c == 't') {
      fscanf(farq, "%f", &h);
      if ((b * h) > v[1])
        v[1] = b * h;
    } else if (c == 'c') {
      h = 0;
      b = pow(b, 2) * 3.14159;
      ;
      if (b > r)
        r = b;
    }
  }
  fclose(farq);
  printf("Maior area de retangulo: %.2f \n", v[0]);
  printf("Maior area de triangulo: %.2f \n", v[1]);
  printf("Maior area de circulo: %.2f \n", r);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x72,-0x19(%rbp)
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   10a0 <abri_arquivo@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <vazio_arquivo@plt>
mov    -0x18(%rbp),%rdi
mov    0x2ddf(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1228 <main+0x88>
jmp    1340 <main+0x1a0>
mov    -0x18(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %al,-0x1a(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xdc9(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1070 <fscanf@plt>
movsbl -0x1a(%rbp),%eax
cmp    $0x72,%eax
jne    1291 <main+0xf1>
mov    -0x18(%rbp),%rdi
lea    0xda8(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1070 <fscanf@plt>
movss  -0x28(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    128c <main+0xec>
movss  -0x28(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    133b <main+0x19b>
movsbl -0x1a(%rbp),%eax
cmp    $0x74,%eax
jne    12da <main+0x13a>
mov    -0x18(%rbp),%rdi
lea    0xd5f(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1070 <fscanf@plt>
movss  -0x28(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    12d5 <main+0x135>
movss  -0x28(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    1336 <main+0x196>
movsbl -0x1a(%rbp),%eax
cmp    $0x63,%eax
jne    1331 <main+0x191>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x2,%edi
call   10c0 <pow@plt>
movsd  0xcfa(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
ucomiss -0x30(%rbp),%xmm0
jbe    132c <main+0x18c>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    1331 <main+0x191>
jmp    1336 <main+0x196>
jmp    133b <main+0x19b>
jmp    120a <main+0x6a>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movss  -0x24(%rbp),%xmm0
lea    0xcb6(%rip),%rdi
call   1050 <printf@plt>
movss  -0x20(%rbp),%xmm0
lea    0xcc5(%rip),%rdi
call   1050 <printf@plt>
movss  -0x30(%rbp),%xmm0
lea    0xcd4(%rip),%rdi
call   1050 <printf@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0x1c(%rsp)
xor    %eax,%eax
call   1090 <abri_arquivo@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1030 <vazio_arquivo@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r13,%rdi
call   1080 <feof@plt>
xorps  %xmm1,%xmm1
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
test   %eax,%eax
je     124e <main+0xbe>
movss  %xmm1,0xc(%rsp)
mov    %r13,%rdi
call   1040 <fclose@plt>
lea    0xe03(%rip),%rdi
movss  0xc(%rsp),%xmm0
call   1050 <printf@plt>
lea    0xe11(%rip),%rdi
movss  0x18(%rsp),%xmm0
call   1050 <printf@plt>
lea    0xe1f(%rip),%rdi
movss  0x14(%rsp),%xmm0
call   1050 <printf@plt>
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xorps  %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
lea    0xdaa(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x1c(%rsp),%r12
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
jmp    1299 <main+0x109>
movss  %xmm1,0xc(%rsp)
nopl   0x0(%rax)
mov    %r13,%rdi
call   1080 <feof@plt>
movss  0xc(%rsp),%xmm1
movaps %xmm1,%xmm0
test   %eax,%eax
jne    11f3 <main+0x63>
movss  %xmm0,0xc(%rsp)
mov    %r13,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebx
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <fscanf@plt>
cmp    $0x63,%bl
je     1330 <main+0x1a0>
cmp    $0x74,%bl
je     1300 <main+0x170>
cmp    $0x72,%bl
jne    1280 <main+0xf0>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1060 <fscanf@plt>
movss  0x10(%rsp),%xmm1
mulss  0x1c(%rsp),%xmm1
movss  0xc(%rsp),%xmm0
ucomiss %xmm0,%xmm1
ja     1276 <main+0xe6>
movss  %xmm0,0xc(%rsp)
jmp    1280 <main+0xf0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1060 <fscanf@plt>
movss  0x10(%rsp),%xmm0
mulss  0x1c(%rsp),%xmm0
ucomiss 0x18(%rsp),%xmm0
jbe    1280 <main+0xf0>
movss  %xmm0,0x18(%rsp)
jmp    1280 <main+0xf0>
movl   $0x0,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   10b0 <pow@plt>
mulsd  0xcb0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
ucomiss 0x14(%rsp),%xmm0
jbe    1280 <main+0xf0>
movss  %xmm0,0x14(%rsp)
jmp    1280 <main+0xf0>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [3 x i8] c"%f\00"
@.str.1 = [32 x i8] c"Maior area de retangulo: %.2f \0A\00"
@.str.2 = [32 x i8] c"Maior area de triangulo: %.2f \0A\00"
@.str.3 = [30 x i8] c"Maior area de circulo: %.2f \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i8
%9 = alloca [2 x float]
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 114, i8* %7
%13 = bitcast [2 x float]* %9 to i8*
store float 0.000000e+00, float* %10
store float 0.000000e+00, float* %11
store float 0.000000e+00, float* %12
%14 = call i32* (...) @abri_arquivo()
store i32* %14, i32** %6
%15 = load i32*, i32** %6
%16 = call i32 @vazio_arquivo(i32* %15)
%17 = load i32*, i32** %6
%18 = load i32, i32* @SEEK_SET
%19 = call i32 @fseek(i32* %17, i32 0, i32 %18)
br label %20
20: ; preds = %84, %2
%21 = load i32*, i32** %6
%22 = call i32 @feof(i32* %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br i1 %24, label %25, label %85
25: ; preds = %20
%26 = load i32*, i32** %6
%27 = call signext i8 @fgetc(i32* %26)
store i8 %27, i8* %8
%28 = load i32*, i32** %6
%29 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %10)
%30 = load i8, i8* %8
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 114
br i1 %32, label %33, label %48
33: ; preds = %25
%34 = load i32*, i32** %6
%35 = call i32 @fscanf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %11)
%36 = load float, float* %10
%37 = load float, float* %11
%38 = fmul float %36, %37
%39 = getelementptr inbounds [2 x float], [2 x float]* %9, i64 0, i64 0
%40 = load float, float* %39
%41 = fcmp ogt float %38, %40
br i1 %41, label %42, label %47
42: ; preds = %33
%43 = load float, float* %10
%44 = load float, float* %11
%45 = fmul float %43, %44
%46 = getelementptr inbounds [2 x float], [2 x float]* %9, i64 0, i64 0
store float %45, float* %46
br label %47
47: ; preds = %42, %33
br label %84
48: ; preds = %25
%49 = load i8, i8* %8
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 116
br i1 %51, label %52, label %67
52: ; preds = %48
%53 = load i32*, i32** %6
%54 = call i32 @fscanf(i32* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %11)
%55 = load float, float* %10
%56 = load float, float* %11
%57 = fmul float %55, %56
%58 = getelementptr inbounds [2 x float], [2 x float]* %9, i64 0, i64 1
%59 = load float, float* %58
%60 = fcmp ogt float %57, %59
br i1 %60, label %61, label %66
61: ; preds = %52
%62 = load float, float* %10
%63 = load float, float* %11
%64 = fmul float %62, %63
%65 = getelementptr inbounds [2 x float], [2 x float]* %9, i64 0, i64 1
store float %64, float* %65
br label %66
66: ; preds = %61, %52
br label %83
67: ; preds = %48
%68 = load i8, i8* %8
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 99
br i1 %70, label %71, label %82
71: ; preds = %67
store float 0.000000e+00, float* %11
%72 = load float, float* %10
%73 = call double @pow(float %72, i32 2)
%74 = fmul double %73, 3.141590e+00
%75 = fptrunc double %74 to float
store float %75, float* %10
%76 = load float, float* %10
%77 = load float, float* %12
%78 = fcmp ogt float %76, %77
br i1 %78, label %79, label %81
79: ; preds = %71
%80 = load float, float* %10
store float %80, float* %12
br label %81
81: ; preds = %79, %71
br label %82
82: ; preds = %81, %67
br label %83
83: ; preds = %82, %66
br label %84
84: ; preds = %83, %47
br label %20
85: ; preds = %20
%86 = load i32*, i32** %6
%87 = call i32 @fclose(i32* %86)
%88 = getelementptr inbounds [2 x float], [2 x float]* %9, i64 0, i64 0
%89 = load float, float* %88
%90 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), float %89)
%91 = getelementptr inbounds [2 x float], [2 x float]* %9, i64 0, i64 1
%92 = load float, float* %91
%93 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), float %92)
%94 = load float, float* %12
%95 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), float %94)
%96 = load i32, i32* @EXIT_SUCCESS
ret i32 %96
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [3 x i8] c"%f\00"
@.str.1 = [32 x i8] c"Maior area de retangulo: %.2f \0A\00"
@.str.2 = [32 x i8] c"Maior area de triangulo: %.2f \0A\00"
@.str.3 = [30 x i8] c"Maior area de circulo: %.2f \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%6 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%7 = tail call i32* (...) @abri_arquivo()
%8 = tail call i32 @vazio_arquivo(i32* %7)
%9 = load i32, i32* @SEEK_SET
%10 = tail call i32 @fseek(i32* %7, i32 0, i32 %9)
%11 = call i32 @feof(i32* %7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %46
13: ; preds = %2, %40
%14 = phi float [ %43, %40 ], [ 0.000000e+00, %2 ]
%15 = phi float [ %42, %40 ], [ 0.000000e+00, %2 ]
%16 = phi float [ %41, %40 ], [ 0.000000e+00, %2 ]
%17 = call signext i8 @fgetc(i32* %7)
%18 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
switch i8 %17, label %40 [
i8 114, label %19
i8 116, label %26
i8 99, label %33
]
19: ; preds = %13
%20 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %4)
%21 = load float, float* %3
%22 = load float, float* %4
%23 = fmul float %21, %22
%24 = fcmp ogt float %23, %16
br i1 %24, label %25, label %40
25: ; preds = %19
br label %40
26: ; preds = %13
%27 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %4)
%28 = load float, float* %3
%29 = load float, float* %4
%30 = fmul float %28, %29
%31 = fcmp ogt float %30, %15
br i1 %31, label %32, label %40
32: ; preds = %26
br label %40
33: ; preds = %13
store float 0.000000e+00, float* %4
%34 = load float, float* %3
%35 = call double @pow(float %34, i32 2)
%36 = fmul double %35, 3.141590e+00
%37 = fptrunc double %36 to float
store float %37, float* %3
%38 = fcmp olt float %14, %37
br i1 %38, label %39, label %40
39: ; preds = %33
br label %40
40: ; preds = %13, %32, %26, %33, %39, %19, %25
%41 = phi float [ %23, %25 ], [ %16, %19 ], [ %16, %32 ], [ %16, %26 ], [ %16, %39 ], [ %16, %33 ], [ %16, %13 ]
%42 = phi float [ %15, %25 ], [ %15, %19 ], [ %30, %32 ], [ %15, %26 ], [ %15, %39 ], [ %15, %33 ], [ %15, %13 ]
%43 = phi float [ %14, %25 ], [ %14, %19 ], [ %14, %32 ], [ %14, %26 ], [ %37, %39 ], [ %14, %33 ], [ %14, %13 ]
%44 = call i32 @feof(i32* %7)
%45 = icmp eq i32 %44, 0
br i1 %45, label %13, label %46
46: ; preds = %40, %2
%47 = phi float [ 0.000000e+00, %2 ], [ %41, %40 ]
%48 = phi float [ 0.000000e+00, %2 ], [ %42, %40 ]
%49 = phi float [ 0.000000e+00, %2 ], [ %43, %40 ]
%50 = call i32 @fclose(i32* %7)
%51 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), float %47)
%52 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), float %48)
%53 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), float %49)
%54 = load i32, i32* @EXIT_SUCCESS
ret i32 %54
}