#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__ mytolower(char const);
int strincmp(const char *s1, const char *s2) {
  while (*s2) {
    if (mytolower(*s1) != mytolower(*s2))
      return 1;
    s1++;
    s2++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<strincmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1182 <strincmp+0x72>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <mytolower@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <mytolower@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     1165 <strincmp+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1189 <strincmp+0x79>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <strincmp+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strincmp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmpb   $0x0,(%rsi)
je     1158 <strincmp+0x48>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%r14,%rbx,1),%edi
call   1030 <mytolower@plt>
mov    %rax,%r12
movsbl (%r15,%rbx,1),%edi
call   1030 <mytolower@plt>
cmp    %rax,%r12
jne    115c <strincmp+0x4c>
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1130 <strincmp+0x20>
xor    %eax,%eax
jmp    1161 <strincmp+0x51>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @strincmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %6
6: ; preds = %19, %2
%7 = load i8*, i8** %5
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = call i64 @mytolower(i8 signext %12)
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = call i64 @mytolower(i8 signext %15)
%17 = icmp ne i64 %13, %16
br i1 %17, label %18, label %19
18: ; preds = %10
store i32 1, i32* %3
br label %25
19: ; preds = %10
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %5
br label %6
24: ; preds = %6
store i32 0, i32* %3
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %3
ret i32 %26
}

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