#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*/ __builtin_coro_alloc();
int /*<<< orphan*/ __builtin_coro_begin(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_destroy(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_done(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_end(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_frame();
int /*<<< orphan*/ __builtin_coro_free(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_id(int, int *, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_param(int *, int *);
int /*<<< orphan*/ __builtin_coro_promise(int /*<<< orphan*/, int,
                                          int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_resume(int /*<<< orphan*/);
int /*<<< orphan*/ __builtin_coro_size();
int /*<<< orphan*/ __builtin_coro_suspend(int);
int /*<<< orphan*/ myAlloc(int /*<<< orphan*/);
void f(int n) {
  int n_copy;
  int promise;
  __builtin_coro_id(32, &promise, 0, 0);
  __builtin_coro_alloc();
  __builtin_coro_begin(myAlloc(__builtin_coro_size()));
  __builtin_coro_resume(__builtin_coro_frame());
  __builtin_coro_destroy(__builtin_coro_frame());
  __builtin_coro_done(__builtin_coro_frame());
  __builtin_coro_promise(__builtin_coro_frame(), 48, 0);
  __builtin_coro_free(__builtin_coro_frame());
  __builtin_coro_end(__builtin_coro_frame(), 0);
  __builtin_coro_suspend(1);
  __builtin_coro_param(&n, &n_copy);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x20,%edi
lea    -0xc(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   10c0 <__builtin_coro_id@plt>
mov    $0x0,%al
call   10b0 <__builtin_coro_alloc@plt>
mov    $0x0,%al
call   1040 <__builtin_coro_size@plt>
mov    %eax,%edi
call   10d0 <myAlloc@plt>
mov    %eax,%edi
call   1030 <__builtin_coro_begin@plt>
mov    $0x0,%al
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   1050 <__builtin_coro_resume@plt>
mov    $0x0,%al
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   10f0 <__builtin_coro_destroy@plt>
mov    $0x0,%al
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   10a0 <__builtin_coro_done@plt>
mov    $0x0,%al
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
mov    $0x30,%esi
xor    %edx,%edx
call   1100 <__builtin_coro_promise@plt>
mov    $0x0,%al
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   1060 <__builtin_coro_free@plt>
mov    $0x0,%al
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1070 <__builtin_coro_end@plt>
mov    $0x1,%edi
call   10e0 <__builtin_coro_suspend@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <__builtin_coro_param@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x18,%rsp
mov    %edi,0xc(%rsp)
lea    0x10(%rsp),%rsi
mov    $0x20,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   10c0 <__builtin_coro_id@plt>
xor    %eax,%eax
call   10b0 <__builtin_coro_alloc@plt>
xor    %eax,%eax
call   1040 <__builtin_coro_size@plt>
mov    %eax,%edi
call   10d0 <myAlloc@plt>
mov    %eax,%edi
call   1030 <__builtin_coro_begin@plt>
xor    %eax,%eax
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   1050 <__builtin_coro_resume@plt>
xor    %eax,%eax
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   10f0 <__builtin_coro_destroy@plt>
xor    %eax,%eax
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   10a0 <__builtin_coro_done@plt>
xor    %eax,%eax
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
mov    $0x30,%esi
xor    %edx,%edx
call   1100 <__builtin_coro_promise@plt>
xor    %eax,%eax
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
call   1060 <__builtin_coro_free@plt>
xor    %eax,%eax
call   1090 <__builtin_coro_frame@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1070 <__builtin_coro_end@plt>
mov    $0x1,%edi
call   10e0 <__builtin_coro_suspend@plt>
lea    0xc(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1080 <__builtin_coro_param@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @__builtin_coro_id(i32 32, i32* %4, i32 0, i32 0)
%6 = call i32 (...) @__builtin_coro_alloc()
%7 = call i32 (...) @__builtin_coro_size()
%8 = call i32 @myAlloc(i32 %7)
%9 = call i32 @__builtin_coro_begin(i32 %8)
%10 = call i32 (...) @__builtin_coro_frame()
%11 = call i32 @__builtin_coro_resume(i32 %10)
%12 = call i32 (...) @__builtin_coro_frame()
%13 = call i32 @__builtin_coro_destroy(i32 %12)
%14 = call i32 (...) @__builtin_coro_frame()
%15 = call i32 @__builtin_coro_done(i32 %14)
%16 = call i32 (...) @__builtin_coro_frame()
%17 = call i32 @__builtin_coro_promise(i32 %16, i32 48, i32 0)
%18 = call i32 (...) @__builtin_coro_frame()
%19 = call i32 @__builtin_coro_free(i32 %18)
%20 = call i32 (...) @__builtin_coro_frame()
%21 = call i32 @__builtin_coro_end(i32 %20, i32 0)
%22 = call i32 @__builtin_coro_suspend(i32 1)
%23 = call i32 @__builtin_coro_param(i32* %2, i32* %3)
ret void
}

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @__builtin_coro_id(i32 32, i32* %4, i32 0, i32 0)
%8 = call i32 (...) @__builtin_coro_alloc()
%9 = call i32 (...) @__builtin_coro_size()
%10 = call i32 @myAlloc(i32 %9)
%11 = call i32 @__builtin_coro_begin(i32 %10)
%12 = call i32 (...) @__builtin_coro_frame()
%13 = call i32 @__builtin_coro_resume(i32 %12)
%14 = call i32 (...) @__builtin_coro_frame()
%15 = call i32 @__builtin_coro_destroy(i32 %14)
%16 = call i32 (...) @__builtin_coro_frame()
%17 = call i32 @__builtin_coro_done(i32 %16)
%18 = call i32 (...) @__builtin_coro_frame()
%19 = call i32 @__builtin_coro_promise(i32 %18, i32 48, i32 0)
%20 = call i32 (...) @__builtin_coro_frame()
%21 = call i32 @__builtin_coro_free(i32 %20)
%22 = call i32 (...) @__builtin_coro_frame()
%23 = call i32 @__builtin_coro_end(i32 %22, i32 0)
%24 = call i32 @__builtin_coro_suspend(i32 1)
%25 = call i32 @__builtin_coro_param(i32* %2, i32* %3)
ret void
}