#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct hsearch_data {
  int dummy;
};
struct TYPE_4__ {
  char *key;
  scalar_t__ data;
};
typedef TYPE_1__ ENTRY;

/* Variables and functions */
int /*<<< orphan*/ FIND;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ hsearch_r(TYPE_1__, int /*<<< orphan*/, TYPE_1__ **,
                     struct hsearch_data *);
int /*<<< orphan*/ stderr;
int aud_get_demuxer_from_mimetype(char *mime,
                                  struct hsearch_data *demuxer_table) {
  ENTRY c, *ret;
  c.key = mime;
  if (hsearch_r(c, FIND, &ret, demuxer_table) == 0) {
    fprintf(stderr, "unknown demuxer: %s\n", c.key);
    return -1;
  }
  return *(int *)ret->data;
}


x86 assembly (clang, -O0):
<aud_get_demuxer_from_mimetype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%r8
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rcx
call   1040 <hsearch_r@plt>
cmp    $0x0,%rax
jne    1185 <aud_get_demuxer_from_mimetype+0x65>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1192 <aud_get_demuxer_from_mimetype+0x72>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aud_get_demuxer_from_mimetype>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %rsi,%r8
call   1040 <hsearch_r@plt>
test   %rax,%rax
je     1150 <aud_get_demuxer_from_mimetype+0x30>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
jmp    116d <aud_get_demuxer_from_mimetype+0x4d>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.hsearch_data = type { i32 }
%struct.TYPE_4__ = type { i8*, i64 }
@FIND = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"unknown demuxer: %s\0A\00"
define i32 @aud_get_demuxer_from_mimetype(i8* %0, %struct.hsearch_data* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.hsearch_data*
%6 = alloca %struct.TYPE_4__
%7 = alloca %struct.TYPE_4__*
store i8* %0, i8** %4
store %struct.hsearch_data* %1, %struct.hsearch_data** %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
store i8* %8, i8** %9
%10 = load i32, i32* @FIND
%11 = load %struct.hsearch_data*, %struct.hsearch_data** %5
%12 = bitcast %struct.TYPE_4__* %6 to { i8*, i64 }*
%13 = getelementptr inbounds { i8*, i64 }, { i8*, i64 }* %12, i32 0, i32 0
%14 = load i8*, i8** %13
%15 = getelementptr inbounds { i8*, i64 }, { i8*, i64 }* %12, i32 0, i32 1
%16 = load i64, i64* %15
%17 = call i64 @hsearch_r(i8* %14, i64 %16, i32 %10, %struct.TYPE_4__** %7, %struct.hsearch_data* %11)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %22)
store i32 -1, i32* %3
br label %30
24: ; preds = %2
%25 = load %struct.TYPE_4__*, %struct.TYPE_4__** %7
%26 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %25, i32 0, i32 1
%27 = load i64, i64* %26
%28 = inttoptr i64 %27 to i32*
%29 = load i32, i32* %28
store i32 %29, i32* %3
br label %30
30: ; preds = %24, %19
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.hsearch_data = type { i32 }
%struct.TYPE_4__ = type { i8*, i64 }
@FIND = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"unknown demuxer: %s\0A\00"
define i32 @aud_get_demuxer_from_mimetype(i8* %0, %struct.hsearch_data* %1) {
%3 = alloca %struct.TYPE_4__*
%4 = bitcast %struct.TYPE_4__** %3 to i8*
%5 = load i32, i32* @FIND
%6 = call i64 @hsearch_r(i8* %0, i64 undef, i32 %5, %struct.TYPE_4__** %3, %struct.hsearch_data* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %17
11: ; preds = %2
%12 = load %struct.TYPE_4__*, %struct.TYPE_4__** %3
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i64 0, i32 1
%14 = load i64, i64* %13
%15 = inttoptr i64 %14 to i32*
%16 = load i32, i32* %15
br label %17
17: ; preds = %11, %8
%18 = phi i32 [ -1, %8 ], [ %16, %11 ]
ret i32 %18
}