#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*/ Cond(char, int, int *);
int /*<<< orphan*/ Left();
int /*<<< orphan*/ Print(char);
int /*<<< orphan*/ Right();
int /*<<< orphan*/ display_tape(int);
void interpret_post_turing(int line, int code[1024][2]) {
  int instruction;
  display_tape(20);
  for (instruction = 0; instruction < line; instruction++) {
    switch (code[instruction][0]) {
    case 0:
      Right();
      break;
    case 1:
      Left();
      break;
    case 2:
      Print((char)code[instruction][1]);
      break;
    default:
      Cond((char)(code[instruction][0] - 2), code[instruction][1],
           &instruction);
      break;
    }
    display_tape(20);
  }
}


x86 assembly (clang, -O0):
<interpret_post_turing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x14,%edi
call   1070 <display_tape@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1228 <interpret_post_turing+0xd8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     11b9 <interpret_post_turing+0x69>
jmp    1197 <interpret_post_turing+0x47>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
je     11c5 <interpret_post_turing+0x75>
jmp    11a8 <interpret_post_turing+0x58>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11d1 <interpret_post_turing+0x81>
jmp    11ea <interpret_post_turing+0x9a>
mov    $0x0,%al
call   1030 <Right@plt>
jmp    1210 <interpret_post_turing+0xc0>
mov    $0x0,%al
call   1040 <Left@plt>
jmp    1210 <interpret_post_turing+0xc0>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%eax
movsbl %al,%edi
call   1050 <Print@plt>
jmp    1210 <interpret_post_turing+0xc0>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%eax
sub    $0x2,%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    0x4(%rcx,%rdx,8),%esi
lea    -0x14(%rbp),%rdx
movsbl %al,%edi
call   1060 <Cond@plt>
mov    $0x14,%edi
call   1070 <display_tape@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1170 <interpret_post_turing+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpret_post_turing>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x14,%edi
call   1070 <display_tape@plt>
movl   $0x0,0xc(%rsp)
test   %ebp,%ebp
jle    11e4 <interpret_post_turing+0x94>
lea    0xc(%rsp),%r14
xor    %eax,%eax
jmp    11a0 <interpret_post_turing+0x50>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <Left@plt>
mov    $0x14,%edi
call   1070 <display_tape@plt>
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
cmp    %ebp,%eax
jge    11e4 <interpret_post_turing+0x94>
cltq
mov    (%rbx,%rax,8),%ecx
cmp    $0x2,%ecx
je     11c0 <interpret_post_turing+0x70>
cmp    $0x1,%ecx
je     1180 <interpret_post_turing+0x30>
test   %ecx,%ecx
jne    11d0 <interpret_post_turing+0x80>
xor    %eax,%eax
call   1030 <Right@plt>
jmp    1187 <interpret_post_turing+0x37>
nopl   0x0(%rax)
movsbl 0x4(%rbx,%rax,8),%edi
call   1050 <Print@plt>
jmp    1187 <interpret_post_turing+0x37>
nopl   0x0(%rax)
add    $0xfe,%cl
mov    0x4(%rbx,%rax,8),%esi
movsbl %cl,%edi
mov    %r14,%rdx
call   1060 <Cond@plt>
jmp    1187 <interpret_post_turing+0x37>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @interpret_post_turing(i32 %0, [2 x i32]* %1) {
%3 = alloca i32
%4 = alloca [2 x i32]*
%5 = alloca i32
store i32 %0, i32* %3
store [2 x i32]* %1, [2 x i32]** %4
%6 = call i32 @display_tape(i32 20)
store i32 0, i32* %5
br label %7
7: ; preds = %49, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %52
11: ; preds = %7
%12 = load [2 x i32]*, [2 x i32]** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 %14
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %15, i64 0, i64 0
%17 = load i32, i32* %16
switch i32 %17, label %31 [
i32 0, label %18
i32 1, label %20
i32 2, label %22
]
18: ; preds = %11
%19 = call i32 (...) @Right()
br label %47
20: ; preds = %11
%21 = call i32 (...) @Left()
br label %47
22: ; preds = %11
%23 = load [2 x i32]*, [2 x i32]** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %23, i64 %25
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %26, i64 0, i64 1
%28 = load i32, i32* %27
%29 = trunc i32 %28 to i8
%30 = call i32 @Print(i8 signext %29)
br label %47
31: ; preds = %11
%32 = load [2 x i32]*, [2 x i32]** %4
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %32, i64 %34
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %35, i64 0, i64 0
%37 = load i32, i32* %36
%38 = sub nsw i32 %37, 2
%39 = trunc i32 %38 to i8
%40 = load [2 x i32]*, [2 x i32]** %4
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %40, i64 %42
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %43, i64 0, i64 1
%45 = load i32, i32* %44
%46 = call i32 @Cond(i8 signext %39, i32 %45, i32* %5)
br label %47
47: ; preds = %31, %22, %20, %18
%48 = call i32 @display_tape(i32 20)
br label %49
49: ; preds = %47
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %7
52: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @interpret_post_turing(i32 %0, [2 x i32]* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @display_tape(i32 20)
store i32 0, i32* %3
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %32
7: ; preds = %2, %27
%8 = phi i32 [ %30, %27 ], [ 0, %2 ]
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %9, i64 0
%11 = load i32, i32* %10
switch i32 %11, label %21 [
i32 0, label %12
i32 1, label %14
i32 2, label %16
]
12: ; preds = %7
%13 = call i32 (...) @Right()
br label %27
14: ; preds = %7
%15 = call i32 (...) @Left()
br label %27
16: ; preds = %7
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %9, i64 1
%18 = load i32, i32* %17
%19 = trunc i32 %18 to i8
%20 = call i32 @Print(i8 signext %19)
br label %27
21: ; preds = %7
%22 = trunc i32 %11 to i8
%23 = add i8 %22, -2
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %9, i64 1
%25 = load i32, i32* %24
%26 = call i32 @Cond(i8 signext %23, i32 %25, i32* %3)
br label %27
27: ; preds = %21, %16, %14, %12
%28 = call i32 @display_tape(i32 20)
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = icmp slt i32 %30, %0
br i1 %31, label %7, label %32
32: ; preds = %27, %2
ret void
}