#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 */
int toupper(char);
int matchoption(char *s, char *t) {
  int d;
  while (((d = toupper(*s) - toupper(*t)) == 0) && (*s != '\0')) {
    s++;
    t++;
  }
  return (d == 0);
}


x86 assembly (clang, -O0):
<matchoption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x1c(%rbp),%ecx
sub    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    1161 <matchoption+0x51>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1171 <matchoption+0x61>
jmp    118e <matchoption+0x7e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <matchoption+0x10>
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchoption>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
movsbl (%rdi),%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
movsbl (%r14),%edi
call   1030 <toupper@plt>
xor    %r15d,%r15d
cmp    %eax,%ebp
jne    116e <matchoption+0x5e>
mov    $0x1,%ebx
nopl   (%rax)
cmpb   $0x0,-0x1(%r12,%rbx,1)
je     1168 <matchoption+0x58>
movsbl (%r12,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
movsbl (%r14,%rbx,1),%edi
call   1030 <toupper@plt>
add    $0x1,%rbx
cmp    %eax,%ebp
je     1140 <matchoption+0x30>
jmp    116e <matchoption+0x5e>
mov    $0x1,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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