#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__ amqp_raw_toupper(char const);
int amqp_raw_equal(const char *first, const char *second) {
  while (*first && *second) {
    if (amqp_raw_toupper(*first) != amqp_raw_toupper(*second)) {
      break;
    }
    first++;
    second++;
  }
  return (amqp_raw_toupper(*first) == amqp_raw_toupper(*second));
}


x86 assembly (clang, -O0):
<amqp_raw_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1145 <amqp_raw_equal+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1155 <amqp_raw_equal+0x45>
jmp    11a3 <amqp_raw_equal+0x93>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <amqp_raw_toupper@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <amqp_raw_toupper@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     1186 <amqp_raw_equal+0x76>
jmp    11a3 <amqp_raw_equal+0x93>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <amqp_raw_equal+0x10>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <amqp_raw_toupper@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <amqp_raw_toupper@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<amqp_raw_equal>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    (%rdi),%al
test   %al,%al
je     115e <amqp_raw_equal+0x4e>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x0,(%r14)
je     1165 <amqp_raw_equal+0x55>
movsbl %al,%edi
call   1030 <amqp_raw_toupper@plt>
mov    %rax,%r15
movsbl (%r14),%edi
call   1030 <amqp_raw_toupper@plt>
cmp    %rax,%r15
jne    1162 <amqp_raw_equal+0x52>
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <amqp_raw_equal+0x20>
xor    %eax,%eax
jmp    1165 <amqp_raw_equal+0x55>
mov    -0x1(%rbx),%al
movsbl %al,%edi
call   1030 <amqp_raw_toupper@plt>
mov    %rax,%rbx
movsbl (%r14),%edi
call   1030 <amqp_raw_toupper@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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