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


x86 assembly (clang, -O0):
<same_string_upcase_first_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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     1153 <same_string_upcase_first_arg+0x43>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1163 <same_string_upcase_first_arg+0x53>
jmp    1180 <same_string_upcase_first_arg+0x70>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <same_string_upcase_first_arg+0x10>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_string_upcase_first_arg>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    (%rdi),%al
test   %al,%al
je     114c <same_string_upcase_first_arg+0x3c>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <toupper@plt>
cmp    (%r14),%al
jne    1150 <same_string_upcase_first_arg+0x40>
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <same_string_upcase_first_arg+0x20>
xor    %ecx,%ecx
jmp    1153 <same_string_upcase_first_arg+0x43>
mov    -0x1(%rbx),%cl
xor    %eax,%eax
cmp    (%r14),%cl
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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