#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 /*<<< orphan*/ bp_sw_capitalise(char *);
char *bp_sw_stringalloc(char *);
int /*<<< orphan*/ free(char *);
int strcmp(char *, char *);
int bp_sw_estrcasecmp(char *one, char *two) {
  char *tempone;
  char *temptwo;
  int out;
  tempone = bp_sw_stringalloc(one);
  temptwo = bp_sw_stringalloc(two);
  bp_sw_capitalise(tempone);
  bp_sw_capitalise(temptwo);
  out = strcmp(tempone, temptwo);
  free(tempone);
  free(temptwo);
  return out;
}


x86 assembly (clang, -O0):
<bp_sw_estrcasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <bp_sw_stringalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <bp_sw_stringalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <bp_sw_capitalise@plt>
mov    -0x20(%rbp),%rdi
call   1040 <bp_sw_capitalise@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bp_sw_estrcasecmp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1060 <bp_sw_stringalloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1060 <bp_sw_stringalloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <bp_sw_capitalise@plt>
mov    %rbx,%rdi
call   1040 <bp_sw_capitalise@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @bp_sw_estrcasecmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call i8* @bp_sw_stringalloc(i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = call i8* @bp_sw_stringalloc(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %5
%13 = call i32 @bp_sw_capitalise(i8* %12)
%14 = load i8*, i8** %6
%15 = call i32 @bp_sw_capitalise(i8* %14)
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @strcmp(i8* %16, i8* %17)
store i32 %18, i32* %7
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
define i32 @bp_sw_estrcasecmp(i8* %0, i8* %1) {
%3 = tail call i8* @bp_sw_stringalloc(i8* %0)
%4 = tail call i8* @bp_sw_stringalloc(i8* %1)
%5 = tail call i32 @bp_sw_capitalise(i8* %3)
%6 = tail call i32 @bp_sw_capitalise(i8* %4)
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
%8 = tail call i32 @free(i8* %3)
%9 = tail call i32 @free(i8* %4)
ret i32 %7
}