#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 *Info_ValueForKey(char *, char *);
int /*<<< orphan*/ gsc_error(char *);
int stack_getnumberofparams();
int /*<<< orphan*/ stack_getparamstring(int, char **);
int /*<<< orphan*/ stack_pushstring(char *);
void gsc_value_for_key() {
  if (stack_getnumberofparams() != 3) {
    gsc_error("[gsc_value_for_key()] wrong number of params");
    return;
  }
  char *str, *str2;
  if (!stack_getparamstring(1, &str) || !stack_getparamstring(2, &str2)) {
    gsc_error("[gsc_value_for_key()] invalid param type(s)");
    return;
  }
  char *out = Info_ValueForKey(str, str2);
  stack_pushstring(out);
}


x86 assembly (clang, -O0):
<gsc_value_for_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1070 <stack_getnumberofparams@plt>
cmp    $0x3,%eax
je     1179 <gsc_value_for_key+0x29>
lea    0xe91(%rip),%rdi
call   1050 <gsc_error@plt>
jmp    11d2 <gsc_value_for_key+0x82>
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
call   1060 <stack_getparamstring@plt>
cmp    $0x0,%eax
je     11a7 <gsc_value_for_key+0x57>
mov    $0x2,%edi
lea    -0x10(%rbp),%rsi
call   1060 <stack_getparamstring@plt>
cmp    $0x0,%eax
jne    11b8 <gsc_value_for_key+0x68>
lea    0xe7f(%rip),%rdi
call   1050 <gsc_error@plt>
jmp    11d2 <gsc_value_for_key+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <Info_ValueForKey@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <stack_pushstring@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsc_value_for_key>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1070 <stack_getnumberofparams@plt>
cmp    $0x3,%eax
jne    11a2 <gsc_value_for_key+0x52>
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
call   1060 <stack_getparamstring@plt>
test   %eax,%eax
je     11b2 <gsc_value_for_key+0x62>
lea    0x8(%rsp),%rsi
mov    $0x2,%edi
call   1060 <stack_getparamstring@plt>
test   %eax,%eax
je     11b2 <gsc_value_for_key+0x62>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1030 <Info_ValueForKey@plt>
mov    %rax,%rdi
call   1040 <stack_pushstring@plt>
add    $0x18,%rsp
ret
lea    0xe57(%rip),%rdi
add    $0x18,%rsp
jmp    1050 <gsc_error@plt>
lea    0xe74(%rip),%rdi
call   1050 <gsc_error@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"[gsc_value_for_key()] wrong number of params\00"
@.str.1 = [44 x i8] c"[gsc_value_for_key()] invalid param type(s)\00"
define void @gsc_value_for_key() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = call i32 (...) @stack_getnumberofparams()
%5 = icmp ne i32 %4, 3
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @gsc_error(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %22
8: ; preds = %0
%9 = call i32 @stack_getparamstring(i32 1, i8** %1)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @stack_getparamstring(i32 2, i8** %2)
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11, %8
%15 = call i32 @gsc_error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %22
16: ; preds = %11
%17 = load i8*, i8** %1
%18 = load i8*, i8** %2
%19 = call i8* @Info_ValueForKey(i8* %17, i8* %18)
store i8* %19, i8** %3
%20 = load i8*, i8** %3
%21 = call i32 @stack_pushstring(i8* %20)
br label %22
22: ; preds = %16, %14, %6
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"[gsc_value_for_key()] wrong number of params\00"
@.str.1 = [44 x i8] c"[gsc_value_for_key()] invalid param type(s)\00"
define void @gsc_value_for_key() {
%1 = alloca i8*
%2 = alloca i8*
%3 = tail call i32 (...) @stack_getnumberofparams()
%4 = icmp eq i32 %3, 3
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @gsc_error(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %23
7: ; preds = %0
%8 = bitcast i8** %1 to i8*
%9 = bitcast i8** %2 to i8*
%10 = call i32 @stack_getparamstring(i32 1, i8** %1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = call i32 @stack_getparamstring(i32 2, i8** %2)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12, %7
%16 = call i32 @gsc_error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %22
17: ; preds = %12
%18 = load i8*, i8** %1
%19 = load i8*, i8** %2
%20 = call i8* @Info_ValueForKey(i8* %18, i8* %19)
%21 = call i32 @stack_pushstring(i8* %20)
br label %22
22: ; preds = %17, %15
br label %23
23: ; preds = %22, %5
ret void
}