#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 */
int /*<<< orphan*/ lwc__dolower(int /*<<< orphan*/);
int lwc__lcase_strncmp(const char *s1, const char *s2, size_t n) {
  while (n--) {
    if (*s1++ != lwc__dolower(*s2++))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<lwc__lcase_strncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1187 <lwc__lcase_strncmp+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
call   1030 <lwc__dolower@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
je     1182 <lwc__lcase_strncmp+0x72>
movl   $0x1,-0x4(%rbp)
jmp    118e <lwc__lcase_strncmp+0x7e>
jmp    1124 <lwc__lcase_strncmp+0x14>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lwc__lcase_strncmp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
xor    %r14d,%r14d
xor    %ebx,%ebx
nopl   0x0(%rax)
cmp    %rbx,%r12
je     1153 <lwc__lcase_strncmp+0x43>
movsbl 0x0(%r13,%rbx,1),%ebp
movsbl (%r15,%rbx,1),%edi
call   1030 <lwc__dolower@plt>
add    $0x1,%rbx
cmp    %ebp,%eax
je     1130 <lwc__lcase_strncmp+0x20>
mov    $0x1,%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 @lwc__lcase_strncmp(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
br label %8
8: ; preds = %24, %3
%9 = load i64, i64* %7
%10 = add i64 %9, -1
store i64 %10, i64* %7
%11 = icmp ne i64 %9, 0
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %6
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = call i32 @lwc__dolower(i32 %20)
%22 = icmp ne i32 %16, %21
br i1 %22, label %23, label %24
23: ; preds = %12
store i32 1, i32* %4
br label %26
24: ; preds = %12
br label %8
25: ; preds = %8
store i32 0, i32* %4
br label %26
26: ; preds = %25, %23
%27 = load i32, i32* %4
ret i32 %27
}

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