#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 KEY_RESIZE;
int getch();
int /*<<< orphan*/ show_dialog_text(char *, char **, int);
void show_dialog(char *title, char *lines[], int num_lines) {
  int c;
  show_dialog_text(title, lines, num_lines);
  while ((c = getch()) != ' ') {
    if (c == KEY_RESIZE) {
      show_dialog_text(title, lines, num_lines);
    }
  }
}


x86 assembly (clang, -O0):
<show_dialog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <show_dialog_text@plt>
mov    $0x0,%al
call   1030 <getch@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x20,%eax
je     117d <show_dialog+0x5d>
mov    -0x18(%rbp),%eax
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%eax
jne    1178 <show_dialog+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <show_dialog_text@plt>
jmp    1143 <show_dialog+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_dialog>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
call   1040 <show_dialog_text@plt>
xor    %eax,%eax
call   1030 <getch@plt>
cmp    $0x20,%eax
jne    114c <show_dialog+0x2c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e9d(%rip),%rbx
jmp    116c <show_dialog+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <getch@plt>
cmp    $0x20,%eax
je     1141 <show_dialog+0x21>
cmp    (%rbx),%eax
jne    1160 <show_dialog+0x40>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1040 <show_dialog_text@plt>
jmp    1160 <show_dialog+0x40>

LLVM IR (-O0):
@KEY_RESIZE = global i32 0
define void @show_dialog(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i8**, i8*** %5
%10 = load i32, i32* %6
%11 = call i32 @show_dialog_text(i8* %8, i8** %9, i32 %10)
br label %12
12: ; preds = %24, %3
%13 = call i32 (...) @getch()
store i32 %13, i32* %7
%14 = icmp ne i32 %13, 32
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %7
%17 = load i32, i32* @KEY_RESIZE
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = call i32 @show_dialog_text(i8* %20, i8** %21, i32 %22)
br label %24
24: ; preds = %19, %15
br label %12
25: ; preds = %12
ret void
}

LLVM IR (-O2):
@KEY_RESIZE = global i32 0
define void @show_dialog(i8* %0, i8** %1, i32 %2) {
%4 = tail call i32 @show_dialog_text(i8* %0, i8** %1, i32 %2)
%5 = tail call i32 (...) @getch()
%6 = icmp eq i32 %5, 32
br i1 %6, label %16, label %7
7: ; preds = %3, %13
%8 = phi i32 [ %14, %13 ], [ %5, %3 ]
%9 = load i32, i32* @KEY_RESIZE
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @show_dialog_text(i8* %0, i8** %1, i32 %2)
br label %13
13: ; preds = %11, %7
%14 = tail call i32 (...) @getch()
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %7
16: ; preds = %13, %3
ret void
}