#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 *lower(char *);
int strcmp(char *, char *);
scalar_t__ strlen(char *);
int mycompare(char *str1, char *str2) {
  int flag = 0;
  if (strlen(str1) == strlen(str2)) {
    str1 = lower(str1);
    str2 = lower(str2);
    flag = strcmp(str1, str2);
    if (flag == 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<mycompare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    11b2 <mycompare+0x82>
mov    -0x10(%rbp),%rdi
call   1050 <lower@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <lower@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11ad <mycompare+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    11b9 <mycompare+0x89>
jmp    11b2 <mycompare+0x82>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mycompare>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbx
jne    1172 <mycompare+0x42>
mov    %r15,%rdi
call   1050 <lower@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <lower@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1176 <mycompare+0x46>
xor    %eax,%eax
jmp    117b <mycompare+0x4b>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @mycompare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
%11 = icmp eq i64 %8, %10
br i1 %11, label %12, label %24
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i8* @lower(i8* %13)
store i8* %14, i8** %4
%15 = load i8*, i8** %5
%16 = call i8* @lower(i8* %15)
store i8* %16, i8** %5
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i32 @strcmp(i8* %17, i8* %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %12
store i32 1, i32* %3
br label %25
23: ; preds = %12
br label %24
24: ; preds = %23, %2
store i32 0, i32* %3
br label %25
25: ; preds = %24, %22
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @mycompare(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = tail call i8* @lower(i8* %0)
%8 = tail call i8* @lower(i8* %1)
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %7, i8* dereferenceable(1) %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %6, %2
br label %12
12: ; preds = %6, %11
%13 = phi i32 [ 0, %11 ], [ 1, %6 ]
ret i32 %13
}