#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 */
typedef union AnyValue {
  int dummy;
} AnyValue;
struct ValueType {
  int dummy;
};
struct Value {
  int dummy;
};
struct ParseState {
  int dummy;
};
struct ExpressionStack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ExpressionStackPushValueNode(struct ParseState *,
                                                struct ExpressionStack **,
                                                struct Value *);
int /*<<< orphan*/ ProgramFail(struct ParseState *, char *);
struct Value *VariableAllocValueFromExistingData(struct ParseState *,
                                                 struct ValueType *,
                                                 union AnyValue *, int,
                                                 struct Value *);
void *VariableDereferencePointer(struct ParseState *, struct Value *,
                                 struct Value **, int *, struct ValueType **,
                                 int *);
void ExpressionStackPushDereference(struct ParseState *Parser,
                                    struct ExpressionStack **StackTop,
                                    struct Value *DereferenceValue) {
  struct Value *DerefVal;
  struct Value *ValueLoc;
  int Offset;
  struct ValueType *DerefType;
  int DerefIsLValue;
  void *DerefDataLoc = VariableDereferencePointer(
      Parser, DereferenceValue, &DerefVal, &Offset, &DerefType, &DerefIsLValue);
  if (DerefDataLoc == 0)
    ProgramFail(Parser, "desreferencia a un puntero Nulo");
  ValueLoc = VariableAllocValueFromExistingData(Parser, DerefType,
                                                (union AnyValue *)DerefDataLoc,
                                                DerefIsLValue, DerefVal);
  ExpressionStackPushValueNode(Parser, StackTop, ValueLoc);
}


x86 assembly (clang, -O0):
<ExpressionStackPushDereference>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    -0x3c(%rbp),%r9
call   1030 <VariableDereferencePointer@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1190 <ExpressionStackPushDereference+0x50>
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <ProgramFail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1050 <VariableAllocValueFromExistingData@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1060 <ExpressionStackPushValueNode@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExpressionStackPushDereference>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x10(%rsp),%rax
lea    0x1c(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <VariableDereferencePointer@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1185 <ExpressionStackPushDereference+0x45>
lea    0xe83(%rip),%rsi
mov    %r15,%rdi
call   1040 <ProgramFail@plt>
mov    0x8(%rsp),%rsi
mov    0x4(%rsp),%ecx
mov    0x10(%rsp),%r8
mov    %r15,%rdi
mov    %rbx,%rdx
call   1050 <VariableAllocValueFromExistingData@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1060 <ExpressionStackPushValueNode@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ParseState = type { i32 }
%struct.ExpressionStack = type { i32 }
%struct.Value = type { i32 }
%struct.ValueType = type { i32 }
%union.AnyValue = type { i32 }
@.str = [32 x i8] c"desreferencia a un puntero Nulo\00"
define void @ExpressionStackPushDereference(%struct.ParseState* %0, %struct.ExpressionStack** %1, %struct.Value* %2) {
%4 = alloca %struct.ParseState*
%5 = alloca %struct.ExpressionStack**
%6 = alloca %struct.Value*
%7 = alloca %struct.Value*
%8 = alloca %struct.Value*
%9 = alloca i32
%10 = alloca %struct.ValueType*
%11 = alloca i32
%12 = alloca i8*
store %struct.ParseState* %0, %struct.ParseState** %4
store %struct.ExpressionStack** %1, %struct.ExpressionStack*** %5
store %struct.Value* %2, %struct.Value** %6
%13 = load %struct.ParseState*, %struct.ParseState** %4
%14 = load %struct.Value*, %struct.Value** %6
%15 = call i8* @VariableDereferencePointer(%struct.ParseState* %13, %struct.Value* %14, %struct.Value** %7, i32* %9, %struct.ValueType** %10, i32* %11)
store i8* %15, i8** %12
%16 = load i8*, i8** %12
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %3
%19 = load %struct.ParseState*, %struct.ParseState** %4
%20 = call i32 @ProgramFail(%struct.ParseState* %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %18, %3
%22 = load %struct.ParseState*, %struct.ParseState** %4
%23 = load %struct.ValueType*, %struct.ValueType** %10
%24 = load i8*, i8** %12
%25 = bitcast i8* %24 to %union.AnyValue*
%26 = load i32, i32* %11
%27 = load %struct.Value*, %struct.Value** %7
%28 = call %struct.Value* @VariableAllocValueFromExistingData(%struct.ParseState* %22, %struct.ValueType* %23, %union.AnyValue* %25, i32 %26, %struct.Value* %27)
store %struct.Value* %28, %struct.Value** %8
%29 = load %struct.ParseState*, %struct.ParseState** %4
%30 = load %struct.ExpressionStack**, %struct.ExpressionStack*** %5
%31 = load %struct.Value*, %struct.Value** %8
%32 = call i32 @ExpressionStackPushValueNode(%struct.ParseState* %29, %struct.ExpressionStack** %30, %struct.Value* %31)
ret void
}

LLVM IR (-O2):
%struct.ParseState = type { i32 }
%struct.ExpressionStack = type { i32 }
%struct.Value = type { i32 }
%struct.ValueType = type { i32 }
%union.AnyValue = type { i32 }
@.str = [32 x i8] c"desreferencia a un puntero Nulo\00"
define void @ExpressionStackPushDereference(%struct.ParseState* %0, %struct.ExpressionStack** %1, %struct.Value* %2) {
%4 = alloca %struct.Value*
%5 = alloca i32
%6 = alloca %struct.ValueType*
%7 = alloca i32
%8 = bitcast %struct.Value** %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast %struct.ValueType** %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = call i8* @VariableDereferencePointer(%struct.ParseState* %0, %struct.Value* %2, %struct.Value** %4, i32* %5, %struct.ValueType** %6, i32* %7)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @ProgramFail(%struct.ParseState* %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
%17 = load %struct.ValueType*, %struct.ValueType** %6
%18 = bitcast i8* %12 to %union.AnyValue*
%19 = load i32, i32* %7
%20 = load %struct.Value*, %struct.Value** %4
%21 = call %struct.Value* @VariableAllocValueFromExistingData(%struct.ParseState* %0, %struct.ValueType* %17, %union.AnyValue* %18, i32 %19, %struct.Value* %20)
%22 = call i32 @ExpressionStackPushValueNode(%struct.ParseState* %0, %struct.ExpressionStack** %1, %struct.Value* %21)
ret void
}