#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*/ boolExpression();
int /*<<< orphan*/ emitln(char *, char *);
int /*<<< orphan*/ match(char);
int /*<<< orphan*/ newLabel(char *);
int /*<<< orphan*/ postLabel(char *, char *);
void doWhile() {
  char label1[10];
  char label2[10];
  match('w');
  newLabel(label1);
  newLabel(label2);
  postLabel(label1, "#WHILE");
  boolExpression();
  emitln("je\t%s", label2);
  block(label2);
  match('e');
  emitln("jmp\t%s", label1);
  postLabel(label2, "#ENDWHILE");
}


x86 assembly (clang, -O0):
<doWhile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x77,%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    0xe71(%rip),%rsi
call   1040 <postLabel@plt>
mov    $0x0,%al
call   1070 <boolExpression@plt>
lea    -0x14(%rbp),%rsi
lea    0xe61(%rip),%rdi
call   1030 <emitln@plt>
lea    -0x14(%rbp),%rdi
call   1080 <block@plt>
mov    $0x65,%edi
call   1060 <match@plt>
lea    -0xa(%rbp),%rsi
lea    0xe44(%rip),%rdi
call   1030 <emitln@plt>
lea    -0x14(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1040 <postLabel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doWhile>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x77,%edi
call   1060 <match@plt>
lea    0xe(%rsp),%r14
mov    %r14,%rdi
call   1050 <newLabel@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <newLabel@plt>
lea    0xe6e(%rip),%rsi
mov    %r14,%rdi
call   1040 <postLabel@plt>
xor    %eax,%eax
call   1070 <boolExpression@plt>
lea    0xe5f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <emitln@plt>
mov    %rbx,%rdi
call   1080 <block@plt>
mov    $0x65,%edi
call   1060 <match@plt>
lea    0xe44(%rip),%rdi
mov    %r14,%rsi
call   1030 <emitln@plt>
lea    0xe3c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <postLabel@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"#WHILE\00"
@.str.1 = [6 x i8] c"je\09%s\00"
@.str.2 = [7 x i8] c"jmp\09%s\00"
@.str.3 = [10 x i8] c"#ENDWHILE\00"
define void @doWhile() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = call i32 @match(i8 signext 119)
%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 ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @boolExpression()
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%12 = call i32 @emitln(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%14 = call i32 @block(i8* %13)
%15 = call i32 @match(i8 signext 101)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%17 = call i32 @emitln(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%19 = call i32 @postLabel(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"#WHILE\00"
@.str.1 = [6 x i8] c"je\09%s\00"
@.str.2 = [7 x i8] c"jmp\09%s\00"
@.str.3 = [10 x i8] c"#ENDWHILE\00"
define void @doWhile() {
%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 119)
%6 = call i32 @newLabel(i8* %3)
%7 = call i32 @newLabel(i8* %4)
%8 = call i32 @postLabel(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @boolExpression()
%10 = call i32 @emitln(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @block(i8* %4)
%12 = call i32 @match(i8 signext 101)
%13 = call i32 @emitln(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%14 = call i32 @postLabel(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret void
}