#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 */
struct properties {
  int dummy;
};

/* Variables and functions */
char *_keystore_get_key_type(struct properties *);
int /*<<< orphan*/ free(char *);
scalar_t__ strcasecmp(char *, char const *);
int _keystore_match_key_type_property(struct properties *properties,
                                      const char *key_type) {
  char *type;
  int rc = 0;
  if (key_type == NULL)
    return 1;
  type = _keystore_get_key_type(properties);
  if (strcasecmp(type, key_type) == 0)
    rc = 1;
  free(type);
  return rc;
}


x86 assembly (clang, -O0):
<_keystore_match_key_type_property>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115e <_keystore_match_key_type_property+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1198 <_keystore_match_key_type_property+0x68>
mov    -0x10(%rbp),%rdi
call   1050 <_keystore_get_key_type@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1189 <_keystore_match_key_type_property+0x59>
movl   $0x1,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_keystore_match_key_type_property>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     1161 <_keystore_match_key_type_property+0x31>
mov    %rsi,%rbx
call   1050 <_keystore_get_key_type@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcasecmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %r14,%rdi
call   1030 <free@plt>
jmp    1166 <_keystore_match_key_type_property+0x36>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.properties = type { i32 }
define i32 @_keystore_match_key_type_property(%struct.properties* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.properties*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store %struct.properties* %0, %struct.properties** %4
store i8* %1, i8** %5
store i32 0, i32* %7
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %23
11: ; preds = %2
%12 = load %struct.properties*, %struct.properties** %4
%13 = call i8* @_keystore_get_key_type(%struct.properties* %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = load i8*, i8** %5
%16 = call i64 @strcasecmp(i8* %14, i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 1, i32* %7
br label %19
19: ; preds = %18, %11
%20 = load i8*, i8** %6
%21 = call i32 @free(i8* %20)
%22 = load i32, i32* %7
store i32 %22, i32* %3
br label %23
23: ; preds = %19, %10
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
%struct.properties = type { i32 }
define i32 @_keystore_match_key_type_property(%struct.properties* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i8* @_keystore_get_key_type(%struct.properties* %0)
%6 = tail call i64 @strcasecmp(i8* %5, i8* %1)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @free(i8* %5)
br label %10
10: ; preds = %2, %4
%11 = phi i32 [ %8, %4 ], [ 1, %2 ]
ret i32 %11
}