#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 */
struct virtual_machine_mask_stack_frame {
  int dummy;
};
struct virtual_machine_mask_stack {
  int dummy;
};
struct virtual_machine {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ virtual_machine_mask_stack_frame_destroy(
    struct virtual_machine *, struct virtual_machine_mask_stack_frame *);
struct virtual_machine_mask_stack_frame *
virtual_machine_mask_stack_frame_new(struct virtual_machine *);
int /*<<< orphan*/
virtual_machine_mask_stack_push(struct virtual_machine_mask_stack *,
                                struct virtual_machine_mask_stack_frame *);
int virtual_machine_mask_stack_push_blank(
    struct virtual_machine *vm, struct virtual_machine_mask_stack *mask_stack) {
  int ret = 0;
  struct virtual_machine_mask_stack_frame *new_mask_stack_frame = NULL;
  if ((new_mask_stack_frame = virtual_machine_mask_stack_frame_new(vm)) ==
      NULL) {
    goto fail;
  }
  virtual_machine_mask_stack_push(mask_stack, new_mask_stack_frame);
  goto done;
fail:
  if (new_mask_stack_frame != NULL) {
    virtual_machine_mask_stack_frame_destroy(vm, new_mask_stack_frame);
  }
done:
  return ret;
}


x86 assembly (clang, -O0):
<virtual_machine_mask_stack_push_blank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <virtual_machine_mask_stack_frame_new@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    116b <virtual_machine_mask_stack_push_blank+0x3b>
jmp    117d <virtual_machine_mask_stack_push_blank+0x4d>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <virtual_machine_mask_stack_push@plt>
jmp    119a <virtual_machine_mask_stack_push_blank+0x6a>
cmpq   $0x0,-0x20(%rbp)
je     1195 <virtual_machine_mask_stack_push_blank+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <virtual_machine_mask_stack_frame_destroy@plt>
jmp    119a <virtual_machine_mask_stack_push_blank+0x6a>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<virtual_machine_mask_stack_push_blank>:
push   %rbx
mov    %rsi,%rbx
call   1040 <virtual_machine_mask_stack_frame_new@plt>
test   %rax,%rax
je     1139 <virtual_machine_mask_stack_push_blank+0x19>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <virtual_machine_mask_stack_push@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.virtual_machine = type { i32 }
%struct.virtual_machine_mask_stack = type { i32 }
%struct.virtual_machine_mask_stack_frame = type { i32 }
define i32 @virtual_machine_mask_stack_push_blank(%struct.virtual_machine* %0, %struct.virtual_machine_mask_stack* %1) {
%3 = alloca %struct.virtual_machine*
%4 = alloca %struct.virtual_machine_mask_stack*
%5 = alloca i32
%6 = alloca %struct.virtual_machine_mask_stack_frame*
store %struct.virtual_machine* %0, %struct.virtual_machine** %3
store %struct.virtual_machine_mask_stack* %1, %struct.virtual_machine_mask_stack** %4
store i32 0, i32* %5
store %struct.virtual_machine_mask_stack_frame* null, %struct.virtual_machine_mask_stack_frame** %6
%7 = load %struct.virtual_machine*, %struct.virtual_machine** %3
%8 = call %struct.virtual_machine_mask_stack_frame* @virtual_machine_mask_stack_frame_new(%struct.virtual_machine* %7)
store %struct.virtual_machine_mask_stack_frame* %8, %struct.virtual_machine_mask_stack_frame** %6
%9 = icmp eq %struct.virtual_machine_mask_stack_frame* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
br label %15
11: ; preds = %2
%12 = load %struct.virtual_machine_mask_stack*, %struct.virtual_machine_mask_stack** %4
%13 = load %struct.virtual_machine_mask_stack_frame*, %struct.virtual_machine_mask_stack_frame** %6
%14 = call i32 @virtual_machine_mask_stack_push(%struct.virtual_machine_mask_stack* %12, %struct.virtual_machine_mask_stack_frame* %13)
br label %23
15: ; preds = %10
%16 = load %struct.virtual_machine_mask_stack_frame*, %struct.virtual_machine_mask_stack_frame** %6
%17 = icmp ne %struct.virtual_machine_mask_stack_frame* %16, null
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load %struct.virtual_machine*, %struct.virtual_machine** %3
%20 = load %struct.virtual_machine_mask_stack_frame*, %struct.virtual_machine_mask_stack_frame** %6
%21 = call i32 @virtual_machine_mask_stack_frame_destroy(%struct.virtual_machine* %19, %struct.virtual_machine_mask_stack_frame* %20)
br label %22
22: ; preds = %18, %15
br label %23
23: ; preds = %22, %11
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
%struct.virtual_machine = type { i32 }
%struct.virtual_machine_mask_stack = type { i32 }
%struct.virtual_machine_mask_stack_frame = type { i32 }
define i32 @virtual_machine_mask_stack_push_blank(%struct.virtual_machine* %0, %struct.virtual_machine_mask_stack* %1) {
%3 = tail call %struct.virtual_machine_mask_stack_frame* @virtual_machine_mask_stack_frame_new(%struct.virtual_machine* %0)
%4 = icmp eq %struct.virtual_machine_mask_stack_frame* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @virtual_machine_mask_stack_push(%struct.virtual_machine_mask_stack* %1, %struct.virtual_machine_mask_stack_frame* %3)
br label %7
7: ; preds = %2, %5
ret i32 0
}