#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 fctstr_ieq(char const *s1, char const *s2) {
  if (s1 == s2) {
    return 1;
  }
  if ((s1 == NULL && s2 != NULL) || (s1 != NULL && s2 == NULL)) {
    return 0;
  }
  while (tolower(*s1) == tolower(*s2)) {
    if (*s1 == '\0')
      return 1;
    s1++;
    s2++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fctstr_ieq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    113a <fctstr_ieq+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    11e3 <fctstr_ieq+0xd3>
cmpq   $0x0,-0x10(%rbp)
jne    1150 <fctstr_ieq+0x40>
cmpq   $0x0,-0x18(%rbp)
jne    1166 <fctstr_ieq+0x56>
cmpq   $0x0,-0x10(%rbp)
je     1172 <fctstr_ieq+0x62>
cmpq   $0x0,-0x18(%rbp)
jne    1172 <fctstr_ieq+0x62>
movl   $0x0,-0x4(%rbp)
jmp    11e3 <fctstr_ieq+0xd3>
jmp    1177 <fctstr_ieq+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    11dc <fctstr_ieq+0xcc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11bf <fctstr_ieq+0xaf>
movl   $0x1,-0x4(%rbp)
jmp    11e3 <fctstr_ieq+0xd3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1177 <fctstr_ieq+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fctstr_ieq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r14d
cmp    %rsi,%rdi
je     119c <fctstr_ieq+0x8c>
mov    %rsi,%r12
mov    %rdi,%r13
test   %rdi,%rdi
jne    1136 <fctstr_ieq+0x26>
test   %r12,%r12
jne    1199 <fctstr_ieq+0x89>
test   %r13,%r13
je     1140 <fctstr_ieq+0x30>
test   %r12,%r12
je     1199 <fctstr_ieq+0x89>
movsbl 0x0(%r13),%edi
call   1030 <tolower@plt>
mov    %rax,%r15
movsbl (%r12),%edi
call   1030 <tolower@plt>
cmp    %rax,%r15
jne    1199 <fctstr_ieq+0x89>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,-0x1(%r13,%rbp,1)
je     119c <fctstr_ieq+0x8c>
movsbl 0x0(%r13,%rbp,1),%edi
call   1030 <tolower@plt>
mov    %rax,%rbx
movsbl (%r12,%rbp,1),%edi
call   1030 <tolower@plt>
add    $0x1,%rbp
cmp    %rax,%rbx
je     1170 <fctstr_ieq+0x60>
xor    %r14d,%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 @fctstr_ieq(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = icmp eq i8* %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %44
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %5
%15 = icmp ne i8* %14, null
br i1 %15, label %22, label %16
16: ; preds = %13, %10
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i8*, i8** %5
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %19, %13
store i32 0, i32* %3
br label %44
23: ; preds = %19, %16
br label %24
24: ; preds = %38, %23
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = call i64 @tolower(i8 signext %26)
%28 = load i8*, i8** %5
%29 = load i8, i8* %28
%30 = call i64 @tolower(i8 signext %29)
%31 = icmp eq i64 %27, %30
br i1 %31, label %32, label %43
32: ; preds = %24
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %32
store i32 1, i32* %3
br label %44
38: ; preds = %32
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %4
%41 = load i8*, i8** %5
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %5
br label %24
43: ; preds = %24
store i32 0, i32* %3
br label %44
44: ; preds = %43, %37, %22, %9
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
define i32 @fctstr_ieq(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %31, label %4
4: ; preds = %2
%5 = icmp eq i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
br i1 %7, label %31, label %8
8: ; preds = %4
%9 = icmp ne i8* %0, null
%10 = icmp eq i8* %1, null
%11 = and i1 %9, %10
br i1 %11, label %31, label %12
12: ; preds = %8
%13 = load i8, i8* %0
%14 = tail call i64 @tolower(i8 signext %13)
%15 = load i8, i8* %1
%16 = tail call i64 @tolower(i8 signext %15)
%17 = icmp eq i64 %14, %16
br i1 %17, label %18, label %31
18: ; preds = %12, %23
%19 = phi i8* [ %25, %23 ], [ %1, %12 ]
%20 = phi i8* [ %24, %23 ], [ %0, %12 ]
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %20, i64 1
%25 = getelementptr inbounds i8, i8* %19, i64 1
%26 = load i8, i8* %24
%27 = tail call i64 @tolower(i8 signext %26)
%28 = load i8, i8* %25
%29 = tail call i64 @tolower(i8 signext %28)
%30 = icmp eq i64 %27, %29
br i1 %30, label %18, label %31
31: ; preds = %18, %23, %12, %4, %8, %2
%32 = phi i32 [ 1, %2 ], [ 0, %8 ], [ 0, %4 ], [ 0, %12 ], [ 1, %18 ], [ 0, %23 ]
ret i32 %32
}