#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__ irc_tolower(char const);
int irc_compare_nicks_int(const char *const nick1, const char *const nick2) {
  int i = 0;
  while (nick1[i] != '\0') {
    if (irc_tolower(nick1[i]) != irc_tolower(nick2[i]))
      return (1);
    i++;
  }
  if (nick2[i] != '\0')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<irc_compare_nicks_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     118c <irc_compare_nicks_int+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <irc_tolower@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <irc_tolower@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     117e <irc_compare_nicks_int+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <irc_compare_nicks_int+0xa4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <irc_compare_nicks_int+0x17>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11ad <irc_compare_nicks_int+0x9d>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <irc_compare_nicks_int+0xa4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_compare_nicks_int>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    (%rdi),%al
test   %al,%al
je     115c <irc_compare_nicks_int+0x4c>
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <irc_tolower@plt>
mov    %rax,%r12
movsbl (%r14,%rbx,1),%edi
call   1030 <irc_tolower@plt>
cmp    %rax,%r12
jne    116a <irc_compare_nicks_int+0x5a>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <irc_compare_nicks_int+0x20>
mov    %ebx,%ecx
jmp    115e <irc_compare_nicks_int+0x4e>
xor    %ecx,%ecx
xor    %eax,%eax
cmpb   $0x0,(%r14,%rcx,1)
setne  %al
jmp    116f <irc_compare_nicks_int+0x5f>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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