#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(unsigned char);
int the_same(char *s1, char *s2) {
  for (; *s1 != '\0'; s1++, s2++) {
    if (tolower((unsigned char)*s1) != tolower((unsigned char)*s2))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<the_same>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118a <the_same+0x7a>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     1168 <the_same+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1191 <the_same+0x81>
jmp    116d <the_same+0x5d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <the_same+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<the_same>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%rdi),%al
mov    $0x1,%r14d
test   %al,%al
je     115d <the_same+0x4d>
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebp,%ebp
nopl   0x0(%rax)
movzbl %al,%edi
call   1030 <tolower@plt>
mov    %rax,%rbx
movzbl (%r15,%rbp,1),%edi
call   1030 <tolower@plt>
cmp    %rax,%rbx
jne    115a <the_same+0x4a>
movzbl 0x1(%r12,%rbp,1),%eax
add    $0x1,%rbp
test   %al,%al
jne    1130 <the_same+0x20>
jmp    115d <the_same+0x4d>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @the_same(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 = %21, %2
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = call i64 @tolower(i8 zeroext %13)
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = call i64 @tolower(i8 zeroext %16)
%18 = icmp ne i64 %14, %17
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 0, i32* %3
br label %27
20: ; preds = %11
br label %21
21: ; preds = %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
br label %6
26: ; preds = %6
store i32 1, i32* %3
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %3
ret i32 %28
}

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