#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__ toupper(char const);
int strmatch(const char *a, const char *b) {
  for (; *a && *b; a++, b++) {
    if (toupper(*a) != toupper(*b))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<strmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1145 <strmatch+0x35>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1155 <strmatch+0x45>
jmp    11af <strmatch+0x9f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     118d <strmatch+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <strmatch+0xa6>
jmp    1192 <strmatch+0x82>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <strmatch+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strmatch>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%rdi),%al
mov    $0x1,%r14d
test   %al,%al
je     1164 <strmatch+0x54>
mov    %rsi,%r12
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
cmpb   $0x0,(%r12,%rbx,1)
je     1164 <strmatch+0x54>
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %rax,%rbp
movsbl (%r12,%rbx,1),%edi
call   1030 <toupper@plt>
cmp    %rax,%rbp
jne    1161 <strmatch+0x51>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strmatch+0x20>
jmp    1164 <strmatch+0x54>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @strmatch(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 = %28, %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 %16
11: ; preds = %6
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ false, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %33
18: ; preds = %16
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = call i64 @toupper(i8 signext %20)
%22 = load i8*, i8** %5
%23 = load i8, i8* %22
%24 = call i64 @toupper(i8 signext %23)
%25 = icmp ne i64 %21, %24
br i1 %25, label %26, label %27
26: ; preds = %18
store i32 0, i32* %3
br label %34
27: ; preds = %18
br label %28
28: ; preds = %27
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %5
br label %6
33: ; preds = %16
store i32 1, i32* %3
br label %34
34: ; preds = %33, %26
%35 = load i32, i32* %3
ret i32 %35
}

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