int coro_A(void **ip) {
  static int i;
  if (*ip)
    goto **ip;
  for (i = 0; i < 10; i++) {
    printf("A%d ", i);
    do {
      *ip = &&LC__0;
      return 1;
    LC__0:;
    } while (0);
  }
  *ip = &&LC__END_A;
LC__END_A:
  return 0;
}


x86 assembly (clang, -O0):
<coro_A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     113a <coro_A+0x2a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11bb <coro_A+0xab>
movl   $0x0,0x2ee8(%rip)
cmpl   $0xa,0x2ee1(%rip)
jge    119d <coro_A+0x8d>
mov    0x2ed5(%rip),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xf(%rip),%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11b2 <coro_A+0xa2>
jmp    1184 <coro_A+0x74>
jmp    1189 <coro_A+0x79>
mov    0x2e9d(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e94(%rip)
jmp    1144 <coro_A+0x34>
mov    -0x10(%rbp),%rax
lea    0x3(%rip),%rcx
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x18(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<coro_A>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
test   %rax,%rax
je     113d <coro_A+0x2d>
jmp    *%rax
mov    0x2f08(%rip),%eax
lea    0x1(%rax),%esi
mov    %esi,0x2eff(%rip)
cmp    $0x8,%eax
jle    1149 <coro_A+0x39>
xor    %eax,%eax
lea    0x2d(%rip),%rcx
jmp    1163 <coro_A+0x53>
movl   $0x0,0x2ee5(%rip)
xor    %esi,%esi
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
lea    -0x45(%rip),%rcx
mov    %rcx,(%rbx)
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@coro_A.i = internal global i32 0
@.str = [5 x i8] c"A%d \00"
define i32 @coro_A(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8**, i8*** %3
%9 = load i8*, i8** %8
br label %29
10: ; preds = %1
store i32 0, i32* @coro_A.i
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* @coro_A.i
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* @coro_A.i
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14
%18 = load i8**, i8*** %3
store i8* blockaddress(@coro_A, %19), i8** %18
store i32 1, i32* %2
br label %27
19: ; preds = %29
br label %20
20: ; preds = %19
br label %21
21: ; preds = %20
%22 = load i32, i32* @coro_A.i
%23 = add nsw i32 %22, 1
store i32 %23, i32* @coro_A.i
br label %11
24: ; preds = %11
%25 = load i8**, i8*** %3
store i8* blockaddress(@coro_A, %26), i8** %25
br label %26
26: ; preds = %24, %29
store i32 0, i32* %2
br label %27
27: ; preds = %26, %17
%28 = load i32, i32* %2
ret i32 %28
29: ; preds = %7
%30 = phi i8* [ %9, %7 ]
indirectbr i8* %30, [label %19, label %26]
}

LLVM IR (-O2):
@coro_A.i = internal unnamed_addr global i32 0
@.str = [5 x i8] c"A%d \00"
define i32 @coro_A(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %5
4: ; preds = %1
store i32 0, i32* @coro_A.i
br label %10
5: ; preds = %1
indirectbr i8* %2, [label %6, label %16]
6: ; preds = %5
%7 = load i32, i32* @coro_A.i
%8 = add nsw i32 %7, 1
store i32 %8, i32* @coro_A.i
%9 = icmp slt i32 %7, 9
br i1 %9, label %10, label %13
10: ; preds = %4, %6
%11 = phi i32 [ 0, %4 ], [ %8, %6 ]
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %6, %10
%14 = phi i8* [ blockaddress(@coro_A, %6), %10 ], [ blockaddress(@coro_A, %16), %6 ]
%15 = phi i32 [ 1, %10 ], [ 0, %6 ]
store i8* %14, i8** %0
br label %16
16: ; preds = %13, %5
%17 = phi i32 [ 0, %5 ], [ %15, %13 ]
ret i32 %17
}