#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 atoi(char const *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  if (argc < 4) {
    printf("Entre com o nome dos 2 arquivos e o tamanho de colunas\n");
  }
  int flag = 0;
  FILE *arq1 = fopen(argv[1], "r");
  FILE *arq2 = fopen(argv[2], "r");
  int colunas = atoi(argv[3]);
  float f1;
  float f2;
  float dif;
  int cont = 0;
  while (!feof(arq1)) {
    fscanf(arq1, "%f,", &f1);
    fscanf(arq2, "%f,", &f2);
    dif = f1 - f2;
    cont++;
    if (((dif) >= 0 ? (dif) : -(dif)) > 1e-5) {
      printf(" [%d,%d] %6.3f & %6.3f \n", cont / colunas, cont % colunas, f1,
             f2);
      flag = 1;
    }
  }
  if (!flag)
    printf("Tudo Ok! =)\n");
  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   $0x4,-0x8(%rbp)
jge    117e <main+0x2e>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeac(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe94(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ea <main+0x9a>
jmp    12b8 <main+0x168>
mov    -0x20(%rbp),%rdi
lea    0xe4d(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe39(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1040 <fscanf@plt>
movss  -0x30(%rbp),%xmm0
subss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movss  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     124a <main+0xfa>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
jmp    1261 <main+0x111>
movss  -0x38(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd8e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12b3 <main+0x163>
mov    -0x3c(%rbp),%eax
cltd
idivl  -0x2c(%rbp)
mov    %eax,%esi
mov    -0x3c(%rbp),%eax
cltd
idivl  -0x2c(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xda1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    11cc <main+0x7c>
cmpl   $0x0,-0x14(%rbp)
jne    12d0 <main+0x180>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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
mov    %rsi,%rbp
cmp    $0x3,%edi
jg     1182 <main+0x22>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbp),%rdi
lea    0xe8b(%rip),%r14
mov    %r14,%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
mov    %r14,%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    0x18(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    127f <main+0x11f>
mov    %ebp,0xc(%rsp)
xor    %r13d,%r13d
mov    $0x1,%ebp
lea    0xe45(%rip),%r12
lea    0x10(%rsp),%r15
jmp    11f3 <main+0x93>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <feof@plt>
add    $0x1,%ebp
test   %eax,%eax
jne    127a <main+0x11a>
mov    %rbx,%rdi
mov    %r12,%rsi
lea    0x14(%rsp),%rdx
call   1050 <fscanf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
movaps %xmm2,%xmm3
xorps  0xdd2(%rip),%xmm3
xorps  %xmm4,%xmm4
cmpless %xmm2,%xmm4
andps  %xmm4,%xmm2
andnps %xmm3,%xmm4
orps   %xmm2,%xmm4
xorps  %xmm2,%xmm2
cvtss2sd %xmm4,%xmm2
ucomisd 0xdc2(%rip),%xmm2
jbe    11e0 <main+0x80>
mov    %ebp,%eax
cltd
idivl  0xc(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xdb8(%rip),%rdi
mov    %eax,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x1,%r13d
jmp    11e0 <main+0x80>
test   %r13d,%r13d
jne    128b <main+0x12b>
lea    0xdb1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Entre com o nome dos 2 arquivos e o tamanho de colunas\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%f,\00"
@.str.3 = [25 x i8] c" [%d,%d] %6.3f & %6.3f \0A\00"
@.str.4 = [13 x i8] c"Tudo Ok! =)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
%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 slt i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
store i32 0, i32* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %8
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %9
store i32 0, i32* %13
br label %31
31: ; preds = %69, %18
%32 = load i32*, i32** %7
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %36, label %70
36: ; preds = %31
%37 = load i32*, i32** %7
%38 = call i32 @fscanf(i32* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float* %10)
%39 = load i32*, i32** %8
%40 = call i32 @fscanf(i32* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float* %11)
%41 = load float, float* %10
%42 = load float, float* %11
%43 = fsub float %41, %42
store float %43, float* %12
%44 = load i32, i32* %13
%45 = add nsw i32 %44, 1
store i32 %45, i32* %13
%46 = load float, float* %12
%47 = fcmp oge float %46, 0.000000e+00
br i1 %47, label %48, label %50
48: ; preds = %36
%49 = load float, float* %12
br label %53
50: ; preds = %36
%51 = load float, float* %12
%52 = fneg float %51
br label %53
53: ; preds = %50, %48
%54 = phi float [ %49, %48 ], [ %52, %50 ]
%55 = fpext float %54 to double
%56 = fcmp ogt double %55, 1.000000e-05
br i1 %56, label %57, label %69
57: ; preds = %53
%58 = load i32, i32* %13
%59 = load i32, i32* %9
%60 = sdiv i32 %58, %59
%61 = load i32, i32* %13
%62 = load i32, i32* %9
%63 = srem i32 %61, %62
%64 = load float, float* %10
%65 = fpext float %64 to double
%66 = load float, float* %11
%67 = fpext float %66 to double
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %60, i32 %63, double %65, double %67)
store i32 1, i32* %6
br label %69
69: ; preds = %57, %53
br label %31
70: ; preds = %31
%71 = load i32, i32* %6
%72 = icmp ne i32 %71, 0
br i1 %72, label %75, label %73
73: ; preds = %70
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %75
75: ; preds = %73, %70
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%f,\00"
@.str.3 = [25 x i8] c" [%d,%d] %6.3f & %6.3f \0A\00"
@str = [12 x i8] c"Tudo Ok! =)\00"
@str.5 = [55 x i8] c"Entre com o nome dos 2 arquivos e o tamanho de colunas\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = alloca float
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.5, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = bitcast float* %3 to i8*
%19 = bitcast float* %4 to i8*
%20 = call i32 @feof(i32* %11)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %48
22: ; preds = %8, %42
%23 = phi i32 [ %30, %42 ], [ 0, %8 ]
%24 = phi i32 [ %43, %42 ], [ 0, %8 ]
%25 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float* %3)
%26 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float* %4)
%27 = load float, float* %3
%28 = load float, float* %4
%29 = fsub float %27, %28
%30 = add nuw nsw i32 %23, 1
%31 = fcmp oge float %29, 0.000000e+00
%32 = fneg float %29
%33 = select i1 %31, float %29, float %32
%34 = fpext float %33 to double
%35 = fcmp ogt double %34, 1.000000e-05
br i1 %35, label %36, label %42
36: ; preds = %22
%37 = sdiv i32 %30, %17
%38 = srem i32 %30, %17
%39 = fpext float %27 to double
%40 = fpext float %28 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %38, double %39, double %40)
br label %42
42: ; preds = %36, %22
%43 = phi i32 [ 1, %36 ], [ %24, %22 ]
%44 = call i32 @feof(i32* %11)
%45 = icmp eq i32 %44, 0
br i1 %45, label %22, label %46
46: ; preds = %42
%47 = icmp eq i32 %43, 0
br i1 %47, label %48, label %50
48: ; preds = %8, %46
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
ret i32 0
}