#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";
  char sbuffer[256];
  clibcode = compname_to_clibcode(compname);
  clibname = clibcode_to_clibname(clibcode);
  if (clibcode == 0) {
    clibversion = "1.0.2.1";
  }
  *complib = strdup(clibname);
  *version = strdup(clibversion);
  return clibcode;
}


x86 assembly (clang, -O0):
<blosc_get_complib_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeb2(%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    117f <blosc_get_complib_info+0x4f>
lea    0xe8d(%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    $0x130,%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 = [8 x i8] c"1.0.2.1\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*
%10 = alloca [256 x 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
%11 = load i8*, i8** %4
%12 = call i32 @compname_to_clibcode(i8* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = call i8* @clibcode_to_clibname(i32 %13)
store i8* %14, i8** %8
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %18
18: ; preds = %17, %3
%19 = load i8*, i8** %8
%20 = call i8* @strdup(i8* %19)
%21 = load i8**, i8*** %5
store i8* %20, i8** %21
%22 = load i8*, i8** %9
%23 = call i8* @strdup(i8* %22)
%24 = load i8**, i8*** %6
store i8* %23, i8** %24
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
@.str = [8 x i8] c"unknown\00"
@.str.1 = [8 x i8] c"1.0.2.1\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 ([8 x i8], [8 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 dereferenceable_or_null(8) i8* @strdup(i8* %7)
store i8* %9, i8** %2
ret i32 %4
}