#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int transition(FILE *out, int from, int to) {
  const char *BV = "begin{lstlisting}";
  const char *EV = "end{lstlisting}";
  const char *strings[4][4] = {
      {"", EV, EV, EV}, {BV, "", "", ""}, {BV, "", "", ""}, {BV, "", "", ""}};
  if (*strings[from][to])
    fprintf(out, "\\%s\n", strings[from][to]);
  return to;
}


x86 assembly (clang, -O0):
<transition>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xed4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xedb(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xee4(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x78(%rbp)
lea    0xea2(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe97(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    0xe84(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe79(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe6e(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    0xe5b(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe50(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe45(%rip),%rax
mov    %rax,-0x28(%rbp)
movslq -0xc(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpb   $0x0,(%rax)
je     1232 <transition+0x122>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdf5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transition>:
push   %rbx
sub    $0x80,%rsp
mov    %edx,%ebx
lea    0xf05(%rip),%rax
mov    %rax,(%rsp)
lea    0xee6(%rip),%rcx
mov    %rcx,0x8(%rsp)
mov    %rcx,0x10(%rsp)
mov    %rcx,0x18(%rsp)
lea    0xebe(%rip),%rcx
mov    %rcx,0x20(%rsp)
mov    %rax,0x28(%rsp)
mov    %rax,0x30(%rsp)
mov    %rax,0x38(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rax,0x48(%rsp)
mov    %rax,0x50(%rsp)
mov    %rax,0x58(%rsp)
mov    %rcx,0x60(%rsp)
mov    %rax,0x68(%rsp)
mov    %rax,0x70(%rsp)
mov    %rax,0x78(%rsp)
movslq %esi,%rax
movslq %edx,%rcx
shl    $0x5,%rax
add    %rsp,%rax
mov    (%rax,%rcx,8),%rdx
cmpb   $0x0,(%rdx)
je     11a0 <transition+0x90>
lea    0xe87(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"begin{lstlisting}\00"
@.str.1 = [16 x i8] c"end{lstlisting}\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c"\\%s\0A\00"
define i32 @transition(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [4 x [4 x i8*]]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %8
%10 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %9, i64 0, i64 0
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %10, i64 0, i64 0
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %8
store i8* %13, i8** %12
%14 = getelementptr inbounds i8*, i8** %12, i64 1
%15 = load i8*, i8** %8
store i8* %15, i8** %14
%16 = getelementptr inbounds i8*, i8** %14, i64 1
%17 = load i8*, i8** %8
store i8* %17, i8** %16
%18 = getelementptr inbounds [4 x i8*], [4 x i8*]* %10, i64 1
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %18, i64 0, i64 0
%20 = load i8*, i8** %7
store i8* %20, i8** %19
%21 = getelementptr inbounds i8*, i8** %19, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %21
%22 = getelementptr inbounds i8*, i8** %21, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %22
%23 = getelementptr inbounds i8*, i8** %22, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %23
%24 = getelementptr inbounds [4 x i8*], [4 x i8*]* %18, i64 1
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %24, i64 0, i64 0
%26 = load i8*, i8** %7
store i8* %26, i8** %25
%27 = getelementptr inbounds i8*, i8** %25, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %27
%28 = getelementptr inbounds i8*, i8** %27, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds i8*, i8** %28, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %29
%30 = getelementptr inbounds [4 x i8*], [4 x i8*]* %24, i64 1
%31 = getelementptr inbounds [4 x i8*], [4 x i8*]* %30, i64 0, i64 0
%32 = load i8*, i8** %7
store i8* %32, i8** %31
%33 = getelementptr inbounds i8*, i8** %31, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %33
%34 = getelementptr inbounds i8*, i8** %33, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %34
%35 = getelementptr inbounds i8*, i8** %34, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %35
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %9, i64 0, i64 %37
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x i8*], [4 x i8*]* %38, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = load i8, i8* %42
%44 = icmp ne i8 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %3
%46 = load i32*, i32** %4
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %9, i64 0, i64 %48
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [4 x i8*], [4 x i8*]* %49, i64 0, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @fprintf(i32* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %45, %3
%56 = load i32, i32* %6
ret i32 %56
}

LLVM IR (-O2):
@.str = [18 x i8] c"begin{lstlisting}\00"
@.str.1 = [16 x i8] c"end{lstlisting}\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c"\\%s\0A\00"
define i32 @transition(i32* nocapture %0, i32 %1, i32 returned %2) {
%4 = alloca [4 x [4 x i8*]]
%5 = bitcast [4 x [4 x i8*]]* %4 to i8*
%6 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 0, i64 0
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 0, i64 1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 0, i64 2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 0, i64 3
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 1, i64 0
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 1, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 1, i64 2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 1, i64 3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 2, i64 0
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 2, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 2, i64 2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 2, i64 3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 3, i64 0
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %18
%19 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 3, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %19
%20 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 3, i64 2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 3, i64 3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %21
%22 = sext i32 %1 to i64
%23 = sext i32 %2 to i64
%24 = getelementptr inbounds [4 x [4 x i8*]], [4 x [4 x i8*]]* %4, i64 0, i64 %22, i64 %23
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %3
%29 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %30
30: ; preds = %28, %3
ret i32 %2
}