#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 *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
size_t strlen(char *);
float compareSound(FILE *descriptorFile1, FILE *descriptorFile2, int nbLinesMin,
                   int nbLinesMax, int nbColumnsMin, int nbColumnsMax) {
  char buffer1[100] = {0};
  char buffer2[100] = {0};
  char currentChar2;
  char currentChar1;
  int value1;
  int value2;
  int i, j;
  int nbSameValue = 0;
  for (i = 0; i < nbLinesMin; i++) {
    for (j = 0; j < nbColumnsMin; j++) {
      do {
        currentChar1 = fgetc(descriptorFile1);
        buffer1[strlen(buffer1)] = currentChar1;
      } while (currentChar1 != '\t' && currentChar1 != '\n');
      do {
        currentChar2 = fgetc(descriptorFile2);
        buffer2[strlen(buffer2)] = currentChar2;
      } while (currentChar2 != '\t' && currentChar2 != '\n');
      value1 = atoi(buffer1);
      value2 = atoi(buffer2);
      if (value1 == value2) {
        nbSameValue++;
      }
      memset(buffer1, 0, 100);
      memset(buffer2, 0, 100);
    }
  }
  return (nbSameValue / ((float)nbLinesMax * (float)nbColumnsMax) * 100.0);
}


x86 assembly (clang, -O0):
<compareSound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x118(%rbp)
movl   $0x0,-0x110(%rbp)
mov    -0x110(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    133f <compareSound+0x1ff>
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1326 <compareSound+0x1e6>
jmp    11c8 <compareSound+0x88>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x102(%rbp)
mov    -0x102(%rbp),%al
mov    %al,-0x119(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x119(%rbp),%cl
mov    %cl,-0x90(%rbp,%rax,1)
movsbl -0x102(%rbp),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x11a(%rbp)
je     1227 <compareSound+0xe7>
movsbl -0x102(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x11a(%rbp)
mov    -0x11a(%rbp),%al
test   $0x1,%al
jne    11c8 <compareSound+0x88>
jmp    123a <compareSound+0xfa>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x101(%rbp)
mov    -0x101(%rbp),%al
mov    %al,-0x11b(%rbp)
lea    -0x100(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x11b(%rbp),%cl
mov    %cl,-0x100(%rbp,%rax,1)
movsbl -0x101(%rbp),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x11c(%rbp)
je     1299 <compareSound+0x159>
movsbl -0x101(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x11c(%rbp)
mov    -0x11c(%rbp),%al
test   $0x1,%al
jne    123a <compareSound+0xfa>
lea    -0x90(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x108(%rbp)
lea    -0x100(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x10c(%rbp)
mov    -0x108(%rbp),%eax
cmp    -0x10c(%rbp),%eax
jne    12ec <compareSound+0x1ac>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11b4 <compareSound+0x74>
jmp    132b <compareSound+0x1eb>
mov    -0x110(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x110(%rbp)
jmp    119b <compareSound+0x5b>
cvtsi2ssl -0x118(%rbp),%xmm0
ff
cvtsi2ssl -0x18(%rbp),%xmm1
cvtsi2ssl -0x20(%rbp),%xmm2
mulss  %xmm2,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc9b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareSound>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %r9d,0x10(%rsp)
mov    %r8d,0x8(%rsp)
mov    %ecx,0xc(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movl   $0x0,0xf0(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x80(%rsp)
mov    %edx,0x14(%rsp)
test   %edx,%edx
jle    12c0 <compareSound+0x180>
mov    %rsi,%rbp
mov    %rdi,%r13
xor    %ebx,%ebx
lea    0x90(%rsp),%r14
lea    0x20(%rsp),%r15
xor    %eax,%eax
jmp    1201 <compareSound+0xc1>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%eax
add    $0x1,%eax
cmp    0x14(%rsp),%eax
je     12c2 <compareSound+0x182>
cmpl   $0x0,0x8(%rsp)
mov    %eax,0x18(%rsp)
jle    11f0 <compareSound+0xb0>
xor    %eax,%eax
xchg   %ax,%ax
mov    %eax,0x1c(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
call   1050 <fgetc@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r12b,0x90(%rsp,%rax,1)
add    $0xf5,%r12b
cmp    $0xfe,%r12b
jb     1220 <compareSound+0xe0>
mov    %ebx,%r12d
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %bl,0x20(%rsp,%rax,1)
add    $0xf5,%bl
cmp    $0xfe,%bl
jb     1250 <compareSound+0x110>
mov    %r14,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1060 <atoi@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
sete   %cl
mov    %r12d,%ebx
add    %ecx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
mov    0x1c(%rsp),%eax
add    $0x1,%eax
cmp    0x8(%rsp),%eax
jne    1210 <compareSound+0xd0>
jmp    11f0 <compareSound+0xb0>
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtsi2ssl 0xc(%rsp),%xmm1
cvtsi2ssl 0x10(%rsp),%xmm2
mulss  %xmm1,%xmm2
divss  %xmm2,%xmm0
mulss  0xd1b(%rip),%xmm0
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float @compareSound(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [100 x i8]
%14 = alloca [100 x i8]
%15 = alloca i8
%16 = alloca i8
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%22 = bitcast [100 x i8]* %13 to i8*
%23 = bitcast [100 x i8]* %14 to i8*
store i32 0, i32* %21
store i32 0, i32* %19
br label %24
24: ; preds = %89, %6
%25 = load i32, i32* %19
%26 = load i32, i32* %9
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %92
28: ; preds = %24
store i32 0, i32* %20
br label %29
29: ; preds = %85, %28
%30 = load i32, i32* %20
%31 = load i32, i32* %11
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %88
33: ; preds = %29
br label %34
34: ; preds = %49, %33
%35 = load i32*, i32** %7
%36 = call signext i8 @fgetc(i32* %35)
store i8 %36, i8* %16
%37 = load i8, i8* %16
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%39 = call i64 @strlen(i8* %38)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 %39
store i8 %37, i8* %40
br label %41
41: ; preds = %34
%42 = load i8, i8* %16
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 9
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = load i8, i8* %16
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 10
br label %49
49: ; preds = %45, %41
%50 = phi i1 [ false, %41 ], [ %48, %45 ]
br i1 %50, label %34, label %51
51: ; preds = %49
br label %52
52: ; preds = %67, %51
%53 = load i32*, i32** %8
%54 = call signext i8 @fgetc(i32* %53)
store i8 %54, i8* %15
%55 = load i8, i8* %15
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%57 = call i64 @strlen(i8* %56)
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 %57
store i8 %55, i8* %58
br label %59
59: ; preds = %52
%60 = load i8, i8* %15
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 9
br i1 %62, label %63, label %67
63: ; preds = %59
%64 = load i8, i8* %15
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %65, 10
br label %67
67: ; preds = %63, %59
%68 = phi i1 [ false, %59 ], [ %66, %63 ]
br i1 %68, label %52, label %69
69: ; preds = %67
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%71 = call i32 @atoi(i8* %70)
store i32 %71, i32* %17
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%73 = call i32 @atoi(i8* %72)
store i32 %73, i32* %18
%74 = load i32, i32* %17
%75 = load i32, i32* %18
%76 = icmp eq i32 %74, %75
br i1 %76, label %77, label %80
77: ; preds = %69
%78 = load i32, i32* %21
%79 = add nsw i32 %78, 1
store i32 %79, i32* %21
br label %80
80: ; preds = %77, %69
%81 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%82 = call i32 @memset(i8* %81, i32 0, i32 100)
%83 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%84 = call i32 @memset(i8* %83, i32 0, i32 100)
br label %85
85: ; preds = %80
%86 = load i32, i32* %20
%87 = add nsw i32 %86, 1
store i32 %87, i32* %20
br label %29
88: ; preds = %29
br label %89
89: ; preds = %88
%90 = load i32, i32* %19
%91 = add nsw i32 %90, 1
store i32 %91, i32* %19
br label %24
92: ; preds = %24
%93 = load i32, i32* %21
%94 = sitofp i32 %93 to float
%95 = load i32, i32* %10
%96 = sitofp i32 %95 to float
%97 = load i32, i32* %12
%98 = sitofp i32 %97 to float
%99 = fmul float %96, %98
%100 = fdiv float %94, %99
%101 = fpext float %100 to double
%102 = fmul double %101, 1.000000e+02
%103 = fptrunc double %102 to float
ret float %103
}

LLVM IR (-O2):
define float @compareSound(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%11 = icmp sgt i32 %2, 0
br i1 %11, label %12, label %46
12: ; preds = %6
%13 = icmp sgt i32 %4, 0
br label %14
14: ; preds = %12, %42
%15 = phi i32 [ 0, %12 ], [ %43, %42 ]
%16 = phi i32 [ 0, %12 ], [ %44, %42 ]
br i1 %13, label %17, label %42
17: ; preds = %14, %32
%18 = phi i32 [ %37, %32 ], [ %15, %14 ]
%19 = phi i32 [ %40, %32 ], [ 0, %14 ]
br label %20
20: ; preds = %17, %20
%21 = call signext i8 @fgetc(i32* %0)
%22 = call i64 @strlen(i8* %9)
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %22
store i8 %21, i8* %23
%24 = add i8 %21, -11
%25 = icmp ult i8 %24, -2
br i1 %25, label %20, label %26
26: ; preds = %20, %26
%27 = call signext i8 @fgetc(i32* %1)
%28 = call i64 @strlen(i8* %10)
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %28
store i8 %27, i8* %29
%30 = add i8 %27, -11
%31 = icmp ult i8 %30, -2
br i1 %31, label %26, label %32
32: ; preds = %26
%33 = call i32 @atoi(i8* %9)
%34 = call i32 @atoi(i8* %10)
%35 = icmp eq i32 %33, %34
%36 = zext i1 %35 to i32
%37 = add nsw i32 %18, %36
%38 = call i32 @memset(i8* %9, i32 0, i32 100)
%39 = call i32 @memset(i8* %10, i32 0, i32 100)
%40 = add nuw nsw i32 %19, 1
%41 = icmp eq i32 %40, %4
br i1 %41, label %42, label %17
42: ; preds = %32, %14
%43 = phi i32 [ %15, %14 ], [ %37, %32 ]
%44 = add nuw nsw i32 %16, 1
%45 = icmp eq i32 %44, %2
br i1 %45, label %46, label %14
46: ; preds = %42, %6
%47 = phi i32 [ 0, %6 ], [ %43, %42 ]
%48 = sitofp i32 %47 to float
%49 = sitofp i32 %3 to float
%50 = sitofp i32 %5 to float
%51 = fmul float %49, %50
%52 = fdiv float %48, %51
%53 = fmul float %52, 1.000000e+02
ret float %53
}