#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*/ block(char *);
int /*<<< orphan*/ emitln(char *, char *);
int /*<<< orphan*/ match(char);
int /*<<< orphan*/ newLabel(char *);
int /*<<< orphan*/ postLabel(char *, char *);
void doLoop() {
  char label1[10];
  char label2[10];
  match('p');
  newLabel(label1);
  newLabel(label2);
  postLabel(label1, "#LOOP");
  block(label2);
  match('e');
  emitln("JMP\t%s\t", label1);
  postLabel(label2, "#ENDLOOP");
}


x86 assembly (clang, -O0):
<doLoop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x70,%edi
call   1060 <match@plt>
lea    -0xa(%rbp),%rdi
call   1050 <newLabel@plt>
lea    -0x14(%rbp),%rdi
call   1050 <newLabel@plt>
lea    -0xa(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1040 <postLabel@plt>
lea    -0x14(%rbp),%rdi
call   1070 <block@plt>
mov    $0x65,%edi
call   1060 <match@plt>
lea    -0xa(%rbp),%rsi
lea    0xe64(%rip),%rdi
call   1030 <emitln@plt>
lea    -0x14(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1040 <postLabel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doLoop>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x70,%edi
call   1060 <match@plt>
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <newLabel@plt>
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <newLabel@plt>
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <postLabel@plt>
mov    %r14,%rdi
call   1070 <block@plt>
mov    $0x65,%edi
call   1060 <match@plt>
lea    0xe63(%rip),%rdi
mov    %rbx,%rsi
call   1030 <emitln@plt>
lea    0xe5c(%rip),%rsi
mov    %r14,%rdi
call   1040 <postLabel@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"#LOOP\00"
@.str.1 = [8 x i8] c"JMP\09%s\09\00"
@.str.2 = [9 x i8] c"#ENDLOOP\00"
define void @doLoop() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = call i32 @match(i8 signext 112)
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = call i32 @newLabel(i8* %4)
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 @newLabel(i8* %6)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%9 = call i32 @postLabel(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = call i32 @block(i8* %10)
%12 = call i32 @match(i8 signext 101)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%14 = call i32 @emitln(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = call i32 @postLabel(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"#LOOP\00"
@.str.1 = [8 x i8] c"JMP\09%s\09\00"
@.str.2 = [9 x i8] c"#ENDLOOP\00"
define void @doLoop() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @match(i8 signext 112)
%6 = call i32 @newLabel(i8* %3)
%7 = call i32 @newLabel(i8* %4)
%8 = call i32 @postLabel(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @block(i8* %4)
%10 = call i32 @match(i8 signext 101)
%11 = call i32 @emitln(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%12 = call i32 @postLabel(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}