#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__ strlen(char *);
scalar_t__ tolower(char);
int isEqualString(char a[], char b[]) {
  int tamanhoa = (int)strlen(a);
  int tamanhob = (int)strlen(b) - 1;
  if (tamanhoa == tamanhob) {
    for (; *a; ++a) {
      if (tolower(*a) != tolower(*b)) {
        return 0;
      }
      ++b;
    }
  } else {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isEqualString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    11c3 <isEqualString+0xa3>
jmp    115c <isEqualString+0x3c>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11be <isEqualString+0x9e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     11a1 <isEqualString+0x81>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <isEqualString+0xb6>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115c <isEqualString+0x3c>
jmp    11cf <isEqualString+0xaf>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <isEqualString+0xb6>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEqualString>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
xor    %r15d,%r15d
cmp    %ebp,%eax
jne    118d <isEqualString+0x6d>
mov    (%r12),%al
mov    $0x1,%r15d
test   %al,%al
je     118d <isEqualString+0x6d>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1040 <tolower@plt>
mov    %rax,%rbp
movsbl (%r14,%rbx,1),%edi
call   1040 <tolower@plt>
cmp    %rax,%rbp
jne    118a <isEqualString+0x6a>
movzbl 0x1(%r12,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <isEqualString+0x40>
jmp    118d <isEqualString+0x6d>
xor    %r15d,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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