#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*/ clear_screen();
int /*<<< orphan*/ do_the_walk();
int /*<<< orphan*/ draw_string(int /*<<< orphan*/, int, char *);
int screen_height();
int /*<<< orphan*/ show_screen();
int /*<<< orphan*/ wait_char();
void walk_the_walk(void) {
  clear_screen();
  draw_string(0, screen_height() - 1, "Click to walk...");
  show_screen();
  wait_char();
  do_the_walk();
  clear_screen();
  draw_string(0, 0, "Walk over.");
  draw_string(0, 2, "Click to exit...");
  show_screen();
  wait_char();
}


x86 assembly (clang, -O0):
<walk_the_walk>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <clear_screen@plt>
mov    $0x0,%al
call   1030 <screen_height@plt>
mov    %eax,%esi
sub    $0x1,%esi
xor    %edi,%edi
lea    0xe80(%rip),%rdx
call   1060 <draw_string@plt>
mov    $0x0,%al
call   1050 <show_screen@plt>
mov    $0x0,%al
call   1040 <wait_char@plt>
mov    $0x0,%al
call   1070 <do_the_walk@plt>
mov    $0x0,%al
call   1080 <clear_screen@plt>
xor    %esi,%esi
lea    0xe67(%rip),%rdx
mov    %esi,%edi
call   1060 <draw_string@plt>
xor    %edi,%edi
mov    $0x2,%esi
lea    0xe5d(%rip),%rdx
call   1060 <draw_string@plt>
mov    $0x0,%al
call   1050 <show_screen@plt>
mov    $0x0,%al
call   1040 <wait_char@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<walk_the_walk>:
push   %rax
xor    %eax,%eax
call   1080 <clear_screen@plt>
xor    %eax,%eax
call   1030 <screen_height@plt>
lea    -0x1(%rax),%esi
lea    0xe87(%rip),%rdx
xor    %edi,%edi
call   1060 <draw_string@plt>
xor    %eax,%eax
call   1050 <show_screen@plt>
xor    %eax,%eax
call   1040 <wait_char@plt>
xor    %eax,%eax
call   1070 <do_the_walk@plt>
xor    %eax,%eax
call   1080 <clear_screen@plt>
lea    0xe6e(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1060 <draw_string@plt>
lea    0xe69(%rip),%rdx
xor    %edi,%edi
mov    $0x2,%esi
call   1060 <draw_string@plt>
xor    %eax,%eax
call   1050 <show_screen@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <wait_char@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Click to walk...\00"
@.str.1 = [11 x i8] c"Walk over.\00"
@.str.2 = [17 x i8] c"Click to exit...\00"
define void @walk_the_walk() {
%1 = call i32 (...) @clear_screen()
%2 = call i32 (...) @screen_height()
%3 = sub nsw i32 %2, 1
%4 = call i32 @draw_string(i32 0, i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @show_screen()
%6 = call i32 (...) @wait_char()
%7 = call i32 (...) @do_the_walk()
%8 = call i32 (...) @clear_screen()
%9 = call i32 @draw_string(i32 0, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @draw_string(i32 0, i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @show_screen()
%12 = call i32 (...) @wait_char()
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Click to walk...\00"
@.str.1 = [11 x i8] c"Walk over.\00"
@.str.2 = [17 x i8] c"Click to exit...\00"
define void @walk_the_walk() {
%1 = tail call i32 (...) @clear_screen()
%2 = tail call i32 (...) @screen_height()
%3 = add nsw i32 %2, -1
%4 = tail call i32 @draw_string(i32 0, i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @show_screen()
%6 = tail call i32 (...) @wait_char()
%7 = tail call i32 (...) @do_the_walk()
%8 = tail call i32 (...) @clear_screen()
%9 = tail call i32 @draw_string(i32 0, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @draw_string(i32 0, i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 (...) @show_screen()
%12 = tail call i32 (...) @wait_char()
ret void
}