#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*/ write_src(char *);
void repeat_handler(void) {
  write_src("if(repeats_left > 0)\n");
  write_src("{\n");
  write_src("if(repeat_line + 1 != vars[0].val)\n");
  write_src("ERROR(\"nested REPEAT\");\n");
  write_src("--repeats_left;\n");
  write_src("if(repeats_left > 0)\n");
  write_src("{\n");
  write_src("JUMP(repeat_line);\n");
  write_src("}\n");
  write_src("}\n");
  write_src("else\n");
  write_src("{\n");
  write_src("repeat_line = POP();\n");
  write_src("repeats_left = POP() - 1;\n");
  write_src("JUMP(repeat_line);\n");
  write_src("}\n");
}


x86 assembly (clang, -O0):
<repeat_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeef(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee6(%rip),%rdi
call   1030 <write_src@plt>
lea    0xefe(%rip),%rdi
call   1030 <write_src@plt>
lea    0xf0b(%rip),%rdi
call   1030 <write_src@plt>
lea    0xea9(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeb3(%rip),%rdi
call   1030 <write_src@plt>
lea    0xef8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xf00(%rip),%rdi
call   1030 <write_src@plt>
lea    0xef4(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%rdi
call   1030 <write_src@plt>
lea    0xe77(%rip),%rdi
call   1030 <write_src@plt>
lea    0xed9(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee3(%rip),%rdi
call   1030 <write_src@plt>
lea    0xea4(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeac(%rip),%rdi
call   1030 <write_src@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeat_handler>:
push   %r15
push   %r14
push   %rbx
lea    0xee4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%r15
mov    %r15,%rdi
call   1030 <write_src@plt>
lea    0xedf(%rip),%rdi
call   1030 <write_src@plt>
lea    0xef7(%rip),%rdi
call   1030 <write_src@plt>
lea    0xf04(%rip),%rdi
call   1030 <write_src@plt>
mov    %rbx,%rdi
call   1030 <write_src@plt>
mov    %r15,%rdi
call   1030 <write_src@plt>
lea    0xef9(%rip),%r14
mov    %r14,%rdi
call   1030 <write_src@plt>
lea    0xefe(%rip),%rbx
mov    %rbx,%rdi
call   1030 <write_src@plt>
mov    %rbx,%rdi
call   1030 <write_src@plt>
lea    0xeea(%rip),%rdi
call   1030 <write_src@plt>
mov    %r15,%rdi
call   1030 <write_src@plt>
lea    0xedc(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee6(%rip),%rdi
call   1030 <write_src@plt>
mov    %r14,%rdi
call   1030 <write_src@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <write_src@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"if(repeats_left > 0)\0A\00"
@.str.1 = [3 x i8] c"{\0A\00"
@.str.2 = [36 x i8] c"if(repeat_line + 1 != vars[0].val)\0A\00"
@.str.3 = [25 x i8] c"ERROR(\22nested REPEAT\22);\0A\00"
@.str.4 = [17 x i8] c"--repeats_left;\0A\00"
@.str.5 = [20 x i8] c"JUMP(repeat_line);\0A\00"
@.str.6 = [3 x i8] c"}\0A\00"
@.str.7 = [6 x i8] c"else\0A\00"
@.str.8 = [22 x i8] c"repeat_line = POP();\0A\00"
@.str.9 = [27 x i8] c"repeats_left = POP() - 1;\0A\00"
define void @repeat_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @write_src(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @write_src(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @write_src(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @write_src(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 @write_src(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%15 = call i32 @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"if(repeats_left > 0)\0A\00"
@.str.1 = [3 x i8] c"{\0A\00"
@.str.2 = [36 x i8] c"if(repeat_line + 1 != vars[0].val)\0A\00"
@.str.3 = [25 x i8] c"ERROR(\22nested REPEAT\22);\0A\00"
@.str.4 = [17 x i8] c"--repeats_left;\0A\00"
@.str.5 = [20 x i8] c"JUMP(repeat_line);\0A\00"
@.str.6 = [3 x i8] c"}\0A\00"
@.str.7 = [6 x i8] c"else\0A\00"
@.str.8 = [22 x i8] c"repeat_line = POP();\0A\00"
@.str.9 = [27 x i8] c"repeats_left = POP() - 1;\0A\00"
define void @repeat_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @write_src(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @write_src(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @write_src(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @write_src(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%14 = tail call i32 @write_src(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%15 = tail call i32 @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%16 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret void
}