#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();
int /*<<< orphan*/ boolExpression();
int /*<<< orphan*/ branch(char *);
int /*<<< orphan*/ branchFalse(char *);
int /*<<< orphan*/ matchString(char *);
int /*<<< orphan*/ newLabel(char *);
int /*<<< orphan*/ postLabel(char *, char *);
void doWhile() {
  char label1[10];
  char label2[10];
  newLabel(label1);
  newLabel(label2);
  postLabel(label1, "#WHILE");
  boolExpression();
  branchFalse(label2);
  block();
  matchString("ENDWHILE");
  branch(label1);
  postLabel(label2, "#ENDWHILE");
}


x86 assembly (clang, -O0):
<doWhile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0xa(%rbp),%rdi
call   1050 <newLabel@plt>
lea    -0x14(%rbp),%rdi
call   1050 <newLabel@plt>
lea    -0xa(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <postLabel@plt>
mov    $0x0,%al
call   1060 <boolExpression@plt>
lea    -0x14(%rbp),%rdi
call   1080 <branchFalse@plt>
mov    $0x0,%al
call   1070 <block@plt>
lea    0xe50(%rip),%rdi
call   1090 <matchString@plt>
lea    -0xa(%rbp),%rdi
call   1040 <branch@plt>
lea    -0x14(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1030 <postLabel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doWhile>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <newLabel@plt>
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <newLabel@plt>
lea    0xe68(%rip),%rsi
mov    %rbx,%rdi
call   1030 <postLabel@plt>
xor    %eax,%eax
call   1060 <boolExpression@plt>
mov    %r14,%rdi
call   1080 <branchFalse@plt>
xor    %eax,%eax
call   1070 <block@plt>
lea    0xe4b(%rip),%rdi
call   1090 <matchString@plt>
mov    %rbx,%rdi
call   1040 <branch@plt>
lea    0xe36(%rip),%rsi
mov    %r14,%rdi
call   1030 <postLabel@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"#WHILE\00"
@.str.1 = [9 x i8] c"ENDWHILE\00"
@.str.2 = [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 = call i32 @newLabel(i8* %3)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @newLabel(i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = call i32 @postLabel(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @boolExpression()
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = call i32 @branchFalse(i8* %10)
%12 = call i32 (...) @block()
%13 = call i32 @matchString(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%15 = call i32 @branch(i8* %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%17 = call i32 @postLabel(i8* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"#WHILE\00"
@.str.1 = [9 x i8] c"ENDWHILE\00"
@.str.2 = [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 = call i32 @newLabel(i8* %3)
%6 = call i32 @newLabel(i8* %4)
%7 = call i32 @postLabel(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @boolExpression()
%9 = call i32 @branchFalse(i8* %4)
%10 = call i32 (...) @block()
%11 = call i32 @matchString(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @branch(i8* %3)
%13 = call i32 @postLabel(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret void
}