#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 /*<<< orphan*/ gsc_error(char *);
int /*<<< orphan*/ gsc_vals_exists(int);
int /*<<< orphan*/ gsc_vals_free(int);
int stack_getnumberofparams();
int /*<<< orphan*/ stack_getparamint(int, int *);
void gsc_free() {
  if (stack_getnumberofparams() != 2) {
    gsc_error("[gsc_free()] wrong number of params");
    return;
  }
  int i;
  if (!stack_getparamint(1, &i)) {
    gsc_error("[gsc_free()] invalid param type");
    return;
  }
  if (!gsc_vals_exists(i))
    return;
  gsc_vals_free(i);
}


x86 assembly (clang, -O0):
<gsc_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <stack_getnumberofparams@plt>
cmp    $0x2,%eax
je     1179 <gsc_free+0x29>
lea    0xe91(%rip),%rdi
call   1060 <gsc_error@plt>
jmp    11bf <gsc_free+0x6f>
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
call   1030 <stack_getparamint@plt>
cmp    $0x0,%eax
jne    11a1 <gsc_free+0x51>
lea    0xe8d(%rip),%rdi
call   1060 <gsc_error@plt>
jmp    11bf <gsc_free+0x6f>
mov    -0x4(%rbp),%edi
call   1050 <gsc_vals_exists@plt>
cmp    $0x0,%eax
jne    11b7 <gsc_free+0x67>
jmp    11bf <gsc_free+0x6f>
mov    -0x4(%rbp),%edi
call   1040 <gsc_vals_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsc_free>:
push   %rax
xor    %eax,%eax
call   1070 <stack_getnumberofparams@plt>
cmp    $0x2,%eax
jne    1188 <gsc_free+0x38>
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1030 <stack_getparamint@plt>
test   %eax,%eax
je     1195 <gsc_free+0x45>
mov    0x4(%rsp),%edi
call   1050 <gsc_vals_exists@plt>
test   %eax,%eax
je     1186 <gsc_free+0x36>
mov    0x4(%rsp),%edi
call   1040 <gsc_vals_free@plt>
pop    %rax
ret
lea    0xe71(%rip),%rdi
pop    %rax
jmp    1060 <gsc_error@plt>
lea    0xe88(%rip),%rdi
call   1060 <gsc_error@plt>
pop    %rax
ret

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

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