int main() {
  static const void *L[] = {&&L1, &&L2, &&L3, &&L4, 0};
  unsigned i = 0;
  printf("A\n");
L1:
  printf("B\n");
L2:
  printf("C\n");
L3:
  printf("D\n");
  goto *L[i++];
L4:
  printf("E\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2ebc(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
jmp    1197 <main+0x87>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
lea    0xed5(%rip),%r14
lea    0xed0(%rip),%r15
lea    0xecb(%rip),%r12
lea    0x2cae(%rip),%rbx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x1,%ebp
jmp    *(%rbx,%rax,8)
jmp    1160 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    114a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1142 <main+0x32>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.L = internal global [5 x i8*] [i8* blockaddress(@main, %4), i8* blockaddress(@main, %6), i8* blockaddress(@main, %8), i8* blockaddress(@main, %15), i8* null]
@.str = [3 x i8] c"A\0A\00"
@.str.1 = [3 x i8] c"B\0A\00"
@.str.2 = [3 x i8] c"C\0A\00"
@.str.3 = [3 x i8] c"D\0A\00"
@.str.4 = [3 x i8] c"E\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %17
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %17
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %17
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = add i32 %10, 1
store i32 %11, i32* %2
%12 = zext i32 %10 to i64
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* @main.L, i64 0, i64 %12
%14 = load i8*, i8** %13
br label %17
15: ; preds = %17
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
17: ; preds = %8
%18 = phi i8* [ %14, %8 ]
indirectbr i8* %18, [label %4, label %6, label %8, label %15]
}

LLVM IR (-O2):
@main.L = internal unnamed_addr constant [5 x i8*] [i8* blockaddress(@main, %2), i8* blockaddress(@main, %5), i8* blockaddress(@main, %8), i8* blockaddress(@main, %15), i8* null]
@str = [2 x i8] c"A\00"
@str.5 = [2 x i8] c"B\00"
@str.6 = [2 x i8] c"C\00"
@str.7 = [2 x i8] c"D\00"
@str.8 = [2 x i8] c"E\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %8
%3 = phi i32 [ 0, %0 ], [ %11, %8 ]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
br label %5
5: ; preds = %2, %8
%6 = phi i32 [ %3, %2 ], [ %11, %8 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ %6, %5 ], [ %11, %8 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%11 = add i32 %9, 1
%12 = zext i32 %9 to i64
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* @main.L, i64 0, i64 %12
%14 = load i8*, i8** %13
indirectbr i8* %14, [label %2, label %5, label %8, label %15]
15: ; preds = %8
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
ret i32 0
}