#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
main(int argc, char *argv[]) {
  FILE *fp;
  char c;
  if (argc != 2) {
    printf("Numero de parametros diferente de dois.\n");
    exit(1);
  }
  fp = fopen(argv[1], "r");
  if (fp == NULL) {
    printf("Nao foi possivel abrir o arquivo.\n");
    exit(2);
  }
  fscanf(fp, "%c", &c);
  while (c != '\n') {
    fscanf(fp, "%c", &c);
  }
  int contpv = 0;
  int min = 10000, max = -1;
  int sigla[2], i = 1;
  fscanf(fp, "%c", &c);
  while (!feof(fp)) {
    if (c == ';')
      contpv++;
    if (contpv == 27 && c != ';' && c != '\"') {
      sigla[i] = c - '0';
      i--;
    }
    if (c == '\n') {
      contpv = 0;
      i = 1;
      int partNum = sigla[1] * 10 + sigla[0];
      if (!feof(fp))
        printf("%d\n", partNum);
      if (partNum > max)
        max = partNum;
      else if (partNum < min)
        min = partNum;
    }
    fscanf(fp, "%c", &c);
  }
  printf("MAX: %d \n", max);
  printf("MIN: %d \n", min);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1198 <main+0x38>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d3 <main+0x73>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xe70(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1050 <fscanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
je     120d <main+0xad>
mov    -0x18(%rbp),%rdi
lea    0xe4f(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1050 <fscanf@plt>
jmp    11e7 <main+0x87>
movl   $0x0,-0x20(%rbp)
movl   $0x2710,-0x24(%rbp)
movl   $0xffffffff,-0x28(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe1a(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    125b <main+0xfb>
jmp    1341 <main+0x1e1>
movsbl -0x19(%rbp),%eax
cmp    $0x3b,%eax
jne    1271 <main+0x111>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1b,-0x20(%rbp)
jne    12ad <main+0x14d>
movsbl -0x19(%rbp),%eax
cmp    $0x3b,%eax
je     12ad <main+0x14d>
movsbl -0x19(%rbp),%eax
cmp    $0x22,%eax
je     12ad <main+0x14d>
movsbl -0x19(%rbp),%ecx
sub    $0x30,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    1328 <main+0x1c8>
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x34(%rbp)
imul   $0xa,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
jne    12f5 <main+0x195>
mov    -0x38(%rbp),%esi
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    130c <main+0x1ac>
mov    -0x38(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1323 <main+0x1c3>
mov    -0x38(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    131e <main+0x1be>
mov    -0x38(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1323 <main+0x1c3>
jmp    1328 <main+0x1c8>
mov    -0x18(%rbp),%rdi
lea    0xd1b(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1050 <fscanf@plt>
jmp    123d <main+0xdd>
mov    -0x28(%rbp),%esi
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    1330 <main+0x1c0>
mov    0x8(%rsi),%rdi
lea    0xe6e(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1346 <main+0x1d6>
mov    %rax,%r15
lea    0xe58(%rip),%rsi
lea    0x7(%rsp),%rdx
mov    %rax,%rdi
call   1060 <fscanf@plt>
cmpb   $0xa,0x7(%rsp)
je     11e5 <main+0x75>
lea    0xe3d(%rip),%rbp
lea    0x7(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
cmpb   $0xa,0x7(%rsp)
jne    11d0 <main+0x60>
lea    0xe16(%rip),%rsi
lea    0x7(%rsp),%rdx
mov    %r15,%rdi
call   1060 <fscanf@plt>
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     1252 <main+0xe2>
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0x2710,0x8(%rsp)
lea    0xded(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xde5(%rip),%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0x2710,0x8(%rsp)
movl   $0xffffffff,0xc(%rsp)
ff
mov    $0x1,%r13d
lea    0xd93(%rip),%r14
lea    0x7(%rsp),%rbx
xor    %r12d,%r12d
jmp    12a1 <main+0x131>
nopl   0x0(%rax)
mov    %eax,%r12d
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1215 <main+0xa5>
movzbl 0x7(%rsp),%ecx
xor    %eax,%eax
cmp    $0x3b,%cl
sete   %al
add    %r12d,%eax
cmp    $0x1b,%eax
jne    12d8 <main+0x168>
mov    $0x1b,%r12d
cmp    $0x22,%cl
je     1283 <main+0x113>
cmp    $0x3b,%cl
je     1283 <main+0x113>
movsbl %cl,%edx
add    $0xffffffd0,%edx
movslq %r13d,%r13
mov    %edx,0x10(%rsp,%r13,4)
add    $0xffffffff,%r13d
cmp    $0xa,%cl
jne    1280 <main+0x110>
mov    0x14(%rsp),%eax
lea    (%rax,%rax,4),%ebp
add    %ebp,%ebp
add    0x10(%rsp),%ebp
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1306 <main+0x196>
lea    0xd08(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%r13d
xor    %r12d,%r12d
cmp    0xc(%rsp),%ebp
jle    131e <main+0x1ae>
mov    %ebp,0xc(%rsp)
jmp    1283 <main+0x113>
mov    0x8(%rsp),%eax
cmp    %eax,%ebp
cmovl  %ebp,%eax
mov    %eax,0x8(%rsp)
jmp    1283 <main+0x113>
lea    0xd08(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xcd0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Numero de parametros diferente de dois.\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [35 x i8] c"Nao foi possivel abrir o arquivo.\0A\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [10 x i8] c"MAX: %d \0A\00"
@.str.6 = [10 x i8] c"MIN: %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [2 x i32]
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %6
%24 = load i32*, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @exit(i32 2)
unreachable
29: ; preds = %19
%30 = load i32*, i32** %6
%31 = call i32 @fscanf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %32
32: ; preds = %36, %29
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 10
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32*, i32** %6
%38 = call i32 @fscanf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %32
39: ; preds = %32
store i32 0, i32* %8
store i32 10000, i32* %9
store i32 -1, i32* %10
store i32 1, i32* %12
%40 = load i32*, i32** %6
%41 = call i32 @fscanf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %42
42: ; preds = %105, %39
%43 = load i32*, i32** %6
%44 = call i32 @feof(i32* %43)
%45 = icmp ne i32 %44, 0
%46 = xor i1 %45, true
br i1 %46, label %47, label %108
47: ; preds = %42
%48 = load i8, i8* %7
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 59
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %54
54: ; preds = %51, %47
%55 = load i32, i32* %8
%56 = icmp eq i32 %55, 27
br i1 %56, label %57, label %74
57: ; preds = %54
%58 = load i8, i8* %7
%59 = sext i8 %58 to i32
%60 = icmp ne i32 %59, 59
br i1 %60, label %61, label %74
61: ; preds = %57
%62 = load i8, i8* %7
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 34
br i1 %64, label %65, label %74
65: ; preds = %61
%66 = load i8, i8* %7
%67 = sext i8 %66 to i32
%68 = sub nsw i32 %67, 48
%69 = load i32, i32* %12
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %70
store i32 %68, i32* %71
%72 = load i32, i32* %12
%73 = add nsw i32 %72, -1
store i32 %73, i32* %12
br label %74
74: ; preds = %65, %61, %57, %54
%75 = load i8, i8* %7
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 10
br i1 %77, label %78, label %105
78: ; preds = %74
store i32 0, i32* %8
store i32 1, i32* %12
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
%80 = load i32, i32* %79
%81 = mul nsw i32 %80, 10
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%83 = load i32, i32* %82
%84 = add nsw i32 %81, %83
store i32 %84, i32* %13
%85 = load i32*, i32** %6
%86 = call i32 @feof(i32* %85)
%87 = icmp ne i32 %86, 0
br i1 %87, label %91, label %88
88: ; preds = %78
%89 = load i32, i32* %13
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %89)
br label %91
91: ; preds = %88, %78
%92 = load i32, i32* %13
%93 = load i32, i32* %10
%94 = icmp sgt i32 %92, %93
br i1 %94, label %95, label %97
95: ; preds = %91
%96 = load i32, i32* %13
store i32 %96, i32* %10
br label %104
97: ; preds = %91
%98 = load i32, i32* %13
%99 = load i32, i32* %9
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %103
101: ; preds = %97
%102 = load i32, i32* %13
store i32 %102, i32* %9
br label %103
103: ; preds = %101, %97
br label %104
104: ; preds = %103, %95
br label %105
105: ; preds = %104, %74
%106 = load i32*, i32** %6
%107 = call i32 @fscanf(i32* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %42
108: ; preds = %42
%109 = load i32, i32* %10
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %109)
%111 = load i32, i32* %9
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %111)
%113 = load i32*, i32** %6
%114 = call i32 @fclose(i32* %113)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [10 x i8] c"MAX: %d \0A\00"
@.str.6 = [10 x i8] c"MIN: %d \0A\00"
@str = [34 x i8] c"Nao foi possivel abrir o arquivo.\00"
@str.7 = [40 x i8] c"Numero de parametros diferente de dois.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = alloca [2 x i32]
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.7, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 2)
unreachable
17: ; preds = %9
%18 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%19 = load i8, i8* %3
%20 = icmp eq i8 %19, 10
br i1 %20, label %25, label %21
21: ; preds = %17, %21
%22 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%23 = load i8, i8* %3
%24 = icmp eq i8 %23, 10
br i1 %24, label %25, label %21
25: ; preds = %21, %17
%26 = bitcast [2 x i32]* %4 to i8*
%27 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%28 = call i32 @feof(i32* %12)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %76
30: ; preds = %25
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
br label %33
33: ; preds = %30, %68
%34 = phi i32 [ 1, %30 ], [ %72, %68 ]
%35 = phi i32 [ -1, %30 ], [ %71, %68 ]
%36 = phi i32 [ 10000, %30 ], [ %70, %68 ]
%37 = phi i32 [ 0, %30 ], [ %69, %68 ]
%38 = load i8, i8* %3
%39 = freeze i8 %38
%40 = icmp eq i8 %39, 59
%41 = zext i1 %40 to i32
%42 = add i32 %37, %41
%43 = icmp eq i32 %42, 27
br i1 %43, label %44, label %51
44: ; preds = %33
switch i8 %39, label %45 [
i8 59, label %68
i8 34, label %68
]
45: ; preds = %44
%46 = sext i8 %39 to i32
%47 = add nsw i32 %46, -48
%48 = sext i32 %34 to i64
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 %48
store i32 %47, i32* %49
%50 = add nsw i32 %34, -1
br label %51
51: ; preds = %33, %45
%52 = phi i32 [ %50, %45 ], [ %34, %33 ]
%53 = icmp eq i8 %39, 10
br i1 %53, label %54, label %68
54: ; preds = %51
%55 = load i32, i32* %31
%56 = mul nsw i32 %55, 10
%57 = load i32, i32* %32
%58 = add nsw i32 %56, %57
%59 = call i32 @feof(i32* %12)
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %54
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %58)
br label %63
63: ; preds = %61, %54
%64 = icmp sgt i32 %58, %35
br i1 %64, label %68, label %65
65: ; preds = %63
%66 = icmp slt i32 %58, %36
%67 = select i1 %66, i32 %58, i32 %36
br label %68
68: ; preds = %44, %44, %65, %63, %51
%69 = phi i32 [ %42, %51 ], [ 0, %63 ], [ 0, %65 ], [ 27, %44 ], [ 27, %44 ]
%70 = phi i32 [ %36, %51 ], [ %36, %63 ], [ %67, %65 ], [ %36, %44 ], [ %36, %44 ]
%71 = phi i32 [ %35, %51 ], [ %58, %63 ], [ %35, %65 ], [ %35, %44 ], [ %35, %44 ]
%72 = phi i32 [ %52, %51 ], [ 1, %63 ], [ 1, %65 ], [ %34, %44 ], [ %34, %44 ]
%73 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%74 = call i32 @feof(i32* %12)
%75 = icmp eq i32 %74, 0
br i1 %75, label %33, label %76
76: ; preds = %68, %25
%77 = phi i32 [ 10000, %25 ], [ %70, %68 ]
%78 = phi i32 [ -1, %25 ], [ %71, %68 ]
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %78)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%81 = call i32 @fclose(i32* %12)
ret i32 0
}