#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 *clibcode_to_clibname(int);
int compname_to_clibcode(char *);
char *strdup(char *);
int blosc_get_complib_info(char *compname, char **complib, char **version) {
  int clibcode;
  char *clibname;
  char *clibversion = "unknown";
  clibcode = compname_to_clibcode(compname);
  clibname = clibcode_to_clibname(clibcode);
  if (clibcode == 0) {
    clibversion = "1.0.3";
  }
  *complib = strdup(clibname);
  *version = strdup(clibversion);
  return clibcode;
}


x86 assembly (clang, -O0):
<blosc_get_complib_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <compname_to_clibcode@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <clibcode_to_clibname@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    117c <blosc_get_complib_info+0x4c>
lea    0xe90(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blosc_get_complib_info>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
call   1030 <compname_to_clibcode@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <clibcode_to_clibname@plt>
test   %ebp,%ebp
lea    0xeb4(%rip),%rcx
lea    0xea5(%rip),%rbx
cmove  %rcx,%rbx
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,(%r15)
mov    %rbx,%rdi
call   1050 <strdup@plt>
mov    %rax,(%r14)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"unknown\00"
@.str.1 = [6 x i8] c"1.0.3\00"
define i32 @blosc_get_complib_info(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = tail call i32 @compname_to_clibcode(i8* %0)
%5 = tail call i8* @clibcode_to_clibname(i32 %4)
%6 = icmp eq i32 %4, 0
%7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
%8 = tail call i8* @strdup(i8* %5)
store i8* %8, i8** %1
%9 = tail call i8* @strdup(i8* %7)
store i8* %9, i8** %2
ret i32 %4
}