#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 */

/* Variables and functions */
scalar_t__ tolower(char const);
int fncompare(const char *isofn, int isosize, const char *normalfn) {
  int i;
  for (i = 0; i < isosize; i++) {
    if (isofn[i] == ';')
      return 0;
    if (tolower(isofn[i]) != tolower(normalfn[i]))
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fncompare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ac <fncompare+0x9c>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    1157 <fncompare+0x47>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <fncompare+0xa3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     1199 <fncompare+0x89>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b3 <fncompare+0xa3>
jmp    119e <fncompare+0x8e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <fncompare+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fncompare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    115e <fncompare+0x4e>
mov    %rdx,%r15
mov    %rdi,%r12
mov    %esi,%r13d
xor    %r14d,%r14d
xor    %ebp,%ebp
nopl   (%rax)
movzbl (%r12,%rbp,1),%eax
cmp    $0x3b,%al
je     1169 <fncompare+0x59>
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %rax,%rbx
movsbl (%r15,%rbp,1),%edi
call   1030 <tolower@plt>
cmp    %rax,%rbx
jne    1163 <fncompare+0x53>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1130 <fncompare+0x20>
jmp    1169 <fncompare+0x59>
xor    %r14d,%r14d
jmp    1169 <fncompare+0x59>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fncompare(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 0, i32* %8
br label %9
9: ; preds = %38, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 59
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 0, i32* %4
br label %42
22: ; preds = %13
%23 = load i8*, i8** %5
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = call i64 @tolower(i8 signext %27)
%29 = load i8*, i8** %7
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = call i64 @tolower(i8 signext %33)
%35 = icmp ne i64 %28, %34
br i1 %35, label %36, label %37
36: ; preds = %22
store i32 -1, i32* %4
br label %42
37: ; preds = %22
br label %38
38: ; preds = %37
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %9
41: ; preds = %9
store i32 0, i32* %4
br label %42
42: ; preds = %41, %36, %21
%43 = load i32, i32* %4
ret i32 %43
}

LLVM IR (-O2):
define i32 @fncompare(i8* nocapture %0, i32 %1, i8* nocapture %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %21
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %9
7: ; preds = %14
%8 = icmp eq i64 %20, %6
br i1 %8, label %21, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %20, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 59
br i1 %13, label %21, label %14
14: ; preds = %9
%15 = tail call i64 @tolower(i8 signext %12)
%16 = getelementptr inbounds i8, i8* %2, i64 %10
%17 = load i8, i8* %16
%18 = tail call i64 @tolower(i8 signext %17)
%19 = icmp eq i64 %15, %18
%20 = add nuw nsw i64 %10, 1
br i1 %19, label %7, label %21
21: ; preds = %9, %14, %7, %3
%22 = phi i32 [ 0, %3 ], [ 0, %7 ], [ -1, %14 ], [ 0, %9 ]
ret i32 %22
}