#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 */
char const qe_toupper(char const);
int html_tagcmp(const char *s1, const char *s2) {
  int d;
  while (*s2) {
    d = *s2 - qe_toupper(*s1);
    if (d)
      return d;
    s2++;
    s1++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<html_tagcmp>:
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 <html_tagcmp+0x72>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <qe_toupper@plt>
mov    %al,%cl
mov    -0x20(%rbp),%eax
movsbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1165 <html_tagcmp+0x55>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <html_tagcmp+0x79>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <html_tagcmp+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_tagcmp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     1152 <html_tagcmp+0x42>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%ebp
movsbl (%r14,%rbx,1),%edi
call   1030 <qe_toupper@plt>
movsbl %al,%eax
sub    %eax,%ebp
jne    1154 <html_tagcmp+0x44>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <html_tagcmp+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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