#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 keynote_get_key_algorithm(char *, int *, int *);
int strlen(char *);
scalar_t__ strncasecmp(char *, char *, int);
int keynote_get_private_key_algorithm(char *key, int *encoding,
                                      int *internalencoding) {
  if (strncasecmp("private-", key, strlen("private-"))) {
    *internalencoding = 0;
    *encoding = 0;
    return 0;
  }
  return keynote_get_key_algorithm(key + strlen("private-"), encoding,
                                   internalencoding);
}


x86 assembly (clang, -O0):
<keynote_get_private_key_algorithm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xead(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe9b(%rip),%rdi
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
je     1194 <keynote_get_private_key_algorithm+0x64>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11c1 <keynote_get_private_key_algorithm+0x91>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe5d(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <keynote_get_key_algorithm@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keynote_get_private_key_algorithm>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeb8(%rip),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     117e <keynote_get_private_key_algorithm+0x4e>
movl   $0x0,(%r14)
movl   $0x0,(%r15)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe7b(%rip),%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <keynote_get_key_algorithm@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"private-\00"
define i32 @keynote_get_private_key_algorithm(i8* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = call i64 @strncasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32*, i32** %7
store i32 0, i32* %13
%14 = load i32*, i32** %6
store i32 0, i32* %14
store i32 0, i32* %4
br label %23
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i32*, i32** %6
%21 = load i32*, i32** %7
%22 = call i32 @keynote_get_key_algorithm(i8* %19, i32* %20, i32* %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %15, %12
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@.str = [9 x i8] c"private-\00"
define i32 @keynote_get_private_key_algorithm(i8* %0, i32* %1, i32* %2) {
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @strncasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %3
store i32 0, i32* %2
store i32 0, i32* %1
br label %13
8: ; preds = %3
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i32 @keynote_get_key_algorithm(i8* %11, i32* %1, i32* %2)
br label %13
13: ; preds = %8, %7
%14 = phi i32 [ 0, %7 ], [ %12, %8 ]
ret i32 %14
}