#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 object {
  int dummy;
};
struct expr {
  int dummy;
};
struct binary_expr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ arith_expr_class_get();
int /*<<< orphan*/ binary_expr_init(struct binary_expr *, struct expr *,
                                    struct expr *, int);
struct object *object_new(int /*<<< orphan*/);
struct expr *arith_expr_new(struct expr *left, struct expr *right,
                            int operator) {
  struct object *expr = object_new(arith_expr_class_get());
  binary_expr_init(((struct binary_expr *)(expr)), left, right, operator);
  return ((struct expr *)(expr));
}


x86 assembly (clang, -O0):
<arith_expr_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <arith_expr_class_get@plt>
mov    %eax,%edi
call   1040 <object_new@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1050 <binary_expr_init@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arith_expr_new>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
xor    %eax,%eax
call   1030 <arith_expr_class_get@plt>
mov    %eax,%edi
call   1040 <object_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1050 <binary_expr_init@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.expr = type { i32 }
%struct.object = type { i32 }
%struct.binary_expr = type { i32 }
define %struct.expr* @arith_expr_new(%struct.expr* %0, %struct.expr* %1, i32 %2) {
%4 = alloca %struct.expr*
%5 = alloca %struct.expr*
%6 = alloca i32
%7 = alloca %struct.object*
store %struct.expr* %0, %struct.expr** %4
store %struct.expr* %1, %struct.expr** %5
store i32 %2, i32* %6
%8 = call i32 (...) @arith_expr_class_get()
%9 = call %struct.object* @object_new(i32 %8)
store %struct.object* %9, %struct.object** %7
%10 = load %struct.object*, %struct.object** %7
%11 = bitcast %struct.object* %10 to %struct.binary_expr*
%12 = load %struct.expr*, %struct.expr** %4
%13 = load %struct.expr*, %struct.expr** %5
%14 = load i32, i32* %6
%15 = call i32 @binary_expr_init(%struct.binary_expr* %11, %struct.expr* %12, %struct.expr* %13, i32 %14)
%16 = load %struct.object*, %struct.object** %7
%17 = bitcast %struct.object* %16 to %struct.expr*
ret %struct.expr* %17
}

LLVM IR (-O2):
%struct.expr = type { i32 }
%struct.object = type { i32 }
%struct.binary_expr = type { i32 }
define %struct.expr* @arith_expr_new(%struct.expr* %0, %struct.expr* %1, i32 %2) {
%4 = tail call i32 (...) @arith_expr_class_get()
%5 = tail call %struct.object* @object_new(i32 %4)
%6 = bitcast %struct.object* %5 to %struct.binary_expr*
%7 = tail call i32 @binary_expr_init(%struct.binary_expr* %6, %struct.expr* %0, %struct.expr* %1, i32 %2)
%8 = bitcast %struct.object* %5 to %struct.expr*
ret %struct.expr* %8
}