#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*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
float comparePicture(FILE *descriptorFile1, FILE *descriptorFile2,
                     int nbLinesMin, int nbLinesMax) {
  char buffer1[100] = {0};
  char buffer2[100] = {0};
  int value1;
  int value2;
  int i;
  int nbSameValue = 0;
  for (i = 0; i < nbLinesMin; i++) {
    fgets(buffer1, 100, descriptorFile1);
    fgets(buffer2, 100, descriptorFile2);
    sscanf(buffer1, "%*s\t%d", &value1);
    sscanf(buffer2, "%*s\t%d", &value2);
    if (value1 == value2) {
      nbSameValue++;
    }
  }
  return (nbSameValue / (float)nbLinesMax * 100.0);
}


x86 assembly (clang, -O0):
<comparePicture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
movl   $0x0,-0x100(%rbp)
movl   $0x0,-0xfc(%rbp)
mov    -0xfc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1221 <comparePicture+0xf1>
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1040 <fgets@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x64,%esi
call   1040 <fgets@plt>
lea    -0x80(%rbp),%rdi
lea    0xe47(%rip),%rsi
lea    -0xf4(%rbp),%rdx
call   1050 <sscanf@plt>
lea    -0xf0(%rbp),%rdi
lea    0xe2d(%rip),%rsi
lea    -0xf8(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0xf4(%rbp),%eax
cmp    -0xf8(%rbp),%eax
jne    1208 <comparePicture+0xd8>
mov    -0x100(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x100(%rbp)
jmp    120d <comparePicture+0xdd>
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    1180 <comparePicture+0x50>
cvtsi2ssl -0x100(%rbp),%xmm0
ff
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comparePicture>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xe0(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
test   %edx,%edx
jle    1227 <comparePicture+0x107>
mov    %edx,%ebp
mov    %rdi,%r13
mov    %ecx,0x4(%rsp)
xor    %r15d,%r15d
mov    %rsi,%r12
nopl   0x0(%rax)
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   1030 <fgets@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
call   1030 <fgets@plt>
mov    %rbx,%rdi
lea    0xe1d(%rip),%rbx
mov    %rbx,%rsi
lea    0xc(%rsp),%rdx
call   1040 <sscanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x8(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0xc(%rsp),%eax
xor    %ecx,%ecx
cmp    0x8(%rsp),%eax
sete   %cl
add    %ecx,%r15d
add    $0xffffffff,%ebp
jne    11b0 <comparePicture+0x90>
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
mov    0x4(%rsp),%ecx
jmp    122a <comparePicture+0x10a>
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm1
divss  %xmm1,%xmm0
mulss  0xdc6(%rip),%xmm0
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%*s\09%d\00"
define float @comparePicture(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = bitcast i32* %7 to i8*
%12 = bitcast i32* %8 to i8*
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %30
14: ; preds = %4, %14
%15 = phi i32 [ %25, %14 ], [ 0, %4 ]
%16 = phi i32 [ %26, %14 ], [ 0, %4 ]
%17 = call i32 @fgets(i8* %9, i32 100, i32* %0)
%18 = call i32 @fgets(i8* %10, i32 100, i32* %1)
%19 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %7)
%20 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %8)
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = icmp eq i32 %21, %22
%24 = zext i1 %23 to i32
%25 = add nuw nsw i32 %15, %24
%26 = add nuw nsw i32 %16, 1
%27 = icmp eq i32 %26, %2
br i1 %27, label %28, label %14
28: ; preds = %14
%29 = sitofp i32 %25 to float
br label %30
30: ; preds = %28, %4
%31 = phi float [ 0.000000e+00, %4 ], [ %29, %28 ]
%32 = sitofp i32 %3 to float
%33 = fdiv float %31, %32
%34 = fmul float %33, 1.000000e+02
ret float %34
}