#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 strlen(char const *);
char toupper(char const);
int StrMatch(const char *arg_1, const char *arg_2) {
  int len = strlen(arg_1);
  int len2 = strlen(arg_2);
  if (len != len2)
    return 0;
  char p1[len], p2[len];
  int i;
  for (i = 0; i < len; i++) {
    p1[i] = toupper(arg_1[i]);
    p2[i] = toupper(arg_2[i]);
  }
  for (i = 0; i < len; i++)
    if (p1[i] != p2[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<StrMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     1160 <StrMatch+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1270 <StrMatch+0x150>
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1202 <StrMatch+0xe2>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ac <StrMatch+0x8c>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    125b <StrMatch+0x13b>
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%rax
movslq -0x3c(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
movslq -0x3c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1248 <StrMatch+0x128>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    1269 <StrMatch+0x149>
jmp    124d <StrMatch+0x12d>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1209 <StrMatch+0xe9>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrMatch>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <strlen@plt>
xor    %r8d,%r8d
cmp    %eax,%ebx
jne    11fd <StrMatch+0xdd>
mov    %rsp,%rcx
mov    %ebx,%esi
mov    %rsp,%r12
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    $0x1,%r8d
test   %ebx,%ebx
jle    11fa <StrMatch+0xda>
mov    %ebx,-0x34(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r14,%rbx
mov    %r15,-0x40(%rbp)
xor    %r15d,%r15d
nop
movsbl (%rbx,%r15,1),%edi
mov    %rsi,%r14
call   1030 <toupper@plt>
mov    %al,(%r12,%r15,1)
mov    -0x40(%rbp),%rax
movsbl (%rax,%r15,1),%edi
call   1030 <toupper@plt>
mov    %r14,%rsi
mov    %al,0x0(%r13,%r15,1)
add    $0x1,%r15
cmp    %r15,%r14
jne    1190 <StrMatch+0x70>
cmpl   $0x0,-0x34(%rbp)
jle    11e7 <StrMatch+0xc7>
xor    %eax,%eax
mov    $0x1,%r8d
xchg   %ax,%ax
movzbl (%r12,%rax,1),%ecx
cmp    0x0(%r13,%rax,1),%cl
jne    11f3 <StrMatch+0xd3>
add    $0x1,%rax
cmp    %rax,%rsi
jne    11d0 <StrMatch+0xb0>
jmp    11f6 <StrMatch+0xd6>
mov    -0x30(%rbp),%rcx
mov    $0x1,%r8d
jmp    11fa <StrMatch+0xda>
xor    %r8d,%r8d
mov    -0x30(%rbp),%rcx
mov    %rcx,%rsp
mov    %r8d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
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*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%13 = load i8*, i8** %4
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %6
%15 = load i8*, i8** %5
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %2
store i32 0, i32* %3
br label %80
21: ; preds = %2
%22 = load i32, i32* %6
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %8
%25 = alloca i8, i64 %23
store i64 %23, i64* %9
%26 = load i32, i32* %6
%27 = zext i32 %26 to i64
%28 = alloca i8, i64 %27
store i64 %27, i64* %10
store i32 0, i32* %11
br label %29
29: ; preds = %52, %21
%30 = load i32, i32* %11
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %55
33: ; preds = %29
%34 = load i8*, i8** %4
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = call signext i8 @toupper(i8 signext %38)
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %25, i64 %41
store i8 %39, i8* %42
%43 = load i8*, i8** %5
%44 = load i32, i32* %11
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = call signext i8 @toupper(i8 signext %47)
%49 = load i32, i32* %11
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %28, i64 %50
store i8 %48, i8* %51
br label %52
52: ; preds = %33
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
store i32 %54, i32* %11
br label %29
55: ; preds = %29
store i32 0, i32* %11
br label %56
56: ; preds = %74, %55
%57 = load i32, i32* %11
%58 = load i32, i32* %6
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %77
60: ; preds = %56
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %25, i64 %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = load i32, i32* %11
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %28, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp ne i32 %65, %70
br i1 %71, label %72, label %73
72: ; preds = %60
store i32 0, i32* %3
store i32 1, i32* %12
br label %78
73: ; preds = %60
br label %74
74: ; preds = %73
%75 = load i32, i32* %11
%76 = add nsw i32 %75, 1
store i32 %76, i32* %11
br label %56
77: ; preds = %56
store i32 1, i32* %3
store i32 1, i32* %12
br label %78
78: ; preds = %77, %72
%79 = load i8*, i8** %8
br label %80
80: ; preds = %78, %20
%81 = load i32, i32* %3
ret i32 %81
}

LLVM IR (-O2):
define i32 @StrMatch(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %37
6: ; preds = %2
%7 = zext i32 %3 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = alloca i8, i64 %7
%11 = icmp sgt i32 %3, 0
br i1 %11, label %13, label %35
12: ; preds = %13
br i1 %11, label %27, label %35
13: ; preds = %6, %13
%14 = phi i64 [ %23, %13 ], [ 0, %6 ]
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = tail call signext i8 @toupper(i8 signext %16)
%18 = getelementptr inbounds i8, i8* %9, i64 %14
store i8 %17, i8* %18
%19 = getelementptr inbounds i8, i8* %1, i64 %14
%20 = load i8, i8* %19
%21 = tail call signext i8 @toupper(i8 signext %20)
%22 = getelementptr inbounds i8, i8* %10, i64 %14
store i8 %21, i8* %22
%23 = add nuw nsw i64 %14, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %12, label %13
25: ; preds = %27
%26 = icmp eq i64 %34, %7
br i1 %26, label %35, label %27
27: ; preds = %12, %25
%28 = phi i64 [ %34, %25 ], [ 0, %12 ]
%29 = getelementptr inbounds i8, i8* %9, i64 %28
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %10, i64 %28
%32 = load i8, i8* %31
%33 = icmp eq i8 %30, %32
%34 = add nuw nsw i64 %28, 1
br i1 %33, label %25, label %35
35: ; preds = %27, %25, %6, %12
%36 = phi i32 [ 1, %12 ], [ 1, %6 ], [ 1, %25 ], [ 0, %27 ]
tail call void @llvm.stackrestore(i8* %8)
br label %37
37: ; preds = %2, %35
%38 = phi i32 [ %36, %35 ], [ 0, %2 ]
ret i32 %38
}