#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*/ __cppwrappers_MOD_allocate_circle(void **);
int /*<<< orphan*/ __cppwrappers_MOD_deallocate_circle(void *);
int __shapes_MOD_circle_area_dt(void *);
int /*<<< orphan*/ __shapes_MOD_circle_ctor_f(void *, int *);
int /*<<< orphan*/ printf(char *, int, ...);
int main(void) {
  void *c;
  int radius = 10;
  int area;
  __cppwrappers_MOD_allocate_circle(&c);
  printf("alocd addr: %p\n", c);
  __shapes_MOD_circle_ctor_f(c, &radius);
  printf("addr after ctor: %p, %d\n", c, (int)c);
  area = __shapes_MOD_circle_area_dt(c);
  printf("Area: %d\n", area);
  __cppwrappers_MOD_deallocate_circle(c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <__cppwrappers_MOD_allocate_circle@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <__shapes_MOD_circle_ctor_f@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    -0x8(%rbp),%rax
mov    %eax,%edx
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <__shapes_MOD_circle_area_dt@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <__cppwrappers_MOD_deallocate_circle@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0xa,0x14(%rsp)
lea    0x8(%rsp),%rdi
call   1060 <__cppwrappers_MOD_allocate_circle@plt>
mov    0x8(%rsp),%esi
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1070 <__shapes_MOD_circle_ctor_f@plt>
mov    0x8(%rsp),%edx
lea    0xe7e(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
call   1030 <__shapes_MOD_circle_area_dt@plt>
lea    0xe7d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
call   1050 <__cppwrappers_MOD_deallocate_circle@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"alocd addr: %p\0A\00"
@.str.1 = [25 x i8] c"addr after ctor: %p, %d\0A\00"
@.str.2 = [10 x i8] c"Area: %d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
store i32 10, i32* %2
%4 = call i32 @__cppwrappers_MOD_allocate_circle(i8** %1)
%5 = load i8*, i8** %1
%6 = ptrtoint i8* %5 to i32
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %1
%9 = call i32 @__shapes_MOD_circle_ctor_f(i8* %8, i32* %2)
%10 = load i8*, i8** %1
%11 = ptrtoint i8* %10 to i32
%12 = load i8*, i8** %1
%13 = ptrtoint i8* %12 to i32
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %13)
%15 = load i8*, i8** %1
%16 = call i32 @__shapes_MOD_circle_area_dt(i8* %15)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %1
%20 = call i32 @__cppwrappers_MOD_deallocate_circle(i8* %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"alocd addr: %p\0A\00"
@.str.1 = [25 x i8] c"addr after ctor: %p, %d\0A\00"
@.str.2 = [10 x i8] c"Area: %d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
%3 = bitcast i8** %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%5 = call i32 @__cppwrappers_MOD_allocate_circle(i8** %1)
%6 = load i8*, i8** %1
%7 = ptrtoint i8* %6 to i64
%8 = trunc i64 %7 to i32
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %1
%11 = call i32 @__shapes_MOD_circle_ctor_f(i8* %10, i32* %2)
%12 = load i8*, i8** %1
%13 = ptrtoint i8* %12 to i64
%14 = trunc i64 %13 to i32
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %14)
%16 = load i8*, i8** %1
%17 = call i32 @__shapes_MOD_circle_area_dt(i8* %16)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %1
%20 = call i32 @__cppwrappers_MOD_deallocate_circle(i8* %19)
ret i32 0
}