#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*/ CA_CacheMarks(int /*<<< orphan*/);
int /*<<< orphan*/ CA_DownLevel();
int /*<<< orphan*/ CA_MarkGrChunk(int);
int /*<<< orphan*/ CA_UpLevel();
int /*<<< orphan*/ IN_ClearKeysDown();
int /*<<< orphan*/ IN_WaitButton();
int /*<<< orphan*/ SD_WaitSoundDone();
int /*<<< orphan*/ US_CPrint(char *);
int /*<<< orphan*/ US_CenterWindow(int, int);
scalar_t__ US_GetPrintY();
scalar_t__ US_GetWindowW();
scalar_t__ US_GetWindowX();
int /*<<< orphan*/ US_GetWindowY();
int /*<<< orphan*/ US_SetPrintY(scalar_t__);
int /*<<< orphan*/ US_SetWindowW(scalar_t__);
int /*<<< orphan*/ VHB_DrawBitmap(scalar_t__, int /*<<< orphan*/, int);
int /*<<< orphan*/ VL_Present();
void CK4_ShowWetsuitMessage(void) {
  SD_WaitSoundDone();
  CA_UpLevel();
  CA_MarkGrChunk(0x6F);
  CA_MarkGrChunk(0x70);
  CA_CacheMarks(0);
  US_CenterWindow(26, 8);
  VHB_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(),
                 0x6F);
  US_SetWindowW(US_GetWindowW() - 0x30);
  US_SetPrintY(US_GetPrintY() + 12);
  US_CPrint("Cool!  I can breathe\n"
            "under water now!");
  VL_Present();
  IN_ClearKeysDown();
  IN_WaitButton();
  VHB_DrawBitmap(US_GetWindowX() + US_GetWindowW(), US_GetWindowY(), 0x70);
  VL_Present();
  IN_ClearKeysDown();
  IN_WaitButton();
  CA_DownLevel();
}


x86 assembly (clang, -O0):
<CK4_ShowWetsuitMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <SD_WaitSoundDone@plt>
mov    $0x0,%al
call   1080 <CA_UpLevel@plt>
mov    $0x6f,%edi
call   10e0 <CA_MarkGrChunk@plt>
mov    $0x70,%edi
call   10e0 <CA_MarkGrChunk@plt>
xor    %edi,%edi
call   1040 <CA_CacheMarks@plt>
mov    $0x1a,%edi
mov    $0x8,%esi
call   10c0 <US_CenterWindow@plt>
mov    $0x0,%al
call   1070 <US_GetWindowX@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1120 <US_GetWindowW@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
sub    $0x30,%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1110 <US_GetWindowY@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    $0x6f,%edx
call   1100 <VHB_DrawBitmap@plt>
mov    $0x0,%al
call   1120 <US_GetWindowW@plt>
mov    %rax,%rdi
sub    $0x30,%rdi
call   1030 <US_SetWindowW@plt>
mov    $0x0,%al
call   10f0 <US_GetPrintY@plt>
mov    %rax,%rdi
add    $0xc,%rdi
call   10a0 <US_SetPrintY@plt>
lea    0xd48(%rip),%rdi
call   1060 <US_CPrint@plt>
mov    $0x0,%al
call   10b0 <VL_Present@plt>
mov    $0x0,%al
call   1130 <IN_ClearKeysDown@plt>
mov    $0x0,%al
call   1090 <IN_WaitButton@plt>
mov    $0x0,%al
call   1070 <US_GetWindowX@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1120 <US_GetWindowW@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1110 <US_GetWindowY@plt>
mov    -0x8(%rbp),%rdi
mov    %eax,%esi
mov    $0x70,%edx
call   1100 <VHB_DrawBitmap@plt>
mov    $0x0,%al
call   10b0 <VL_Present@plt>
mov    $0x0,%al
call   1130 <IN_ClearKeysDown@plt>
mov    $0x0,%al
call   1090 <IN_WaitButton@plt>
mov    $0x0,%al
call   10d0 <CA_DownLevel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CK4_ShowWetsuitMessage>:
push   %rbx
xor    %eax,%eax
call   1050 <SD_WaitSoundDone@plt>
xor    %eax,%eax
call   1080 <CA_UpLevel@plt>
mov    $0x6f,%edi
call   10e0 <CA_MarkGrChunk@plt>
mov    $0x70,%edi
call   10e0 <CA_MarkGrChunk@plt>
xor    %edi,%edi
call   1040 <CA_CacheMarks@plt>
mov    $0x1a,%edi
mov    $0x8,%esi
call   10c0 <US_CenterWindow@plt>
xor    %eax,%eax
call   1070 <US_GetWindowX@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1120 <US_GetWindowW@plt>
add    %rax,%rbx
add    $0xffffffffffffffd0,%rbx
xor    %eax,%eax
call   1110 <US_GetWindowY@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x6f,%edx
call   1100 <VHB_DrawBitmap@plt>
xor    %eax,%eax
call   1120 <US_GetWindowW@plt>
lea    -0x30(%rax),%rdi
call   1030 <US_SetWindowW@plt>
xor    %eax,%eax
call   10f0 <US_GetPrintY@plt>
lea    0xc(%rax),%rdi
call   10a0 <US_SetPrintY@plt>
lea    0xd62(%rip),%rdi
call   1060 <US_CPrint@plt>
xor    %eax,%eax
call   10b0 <VL_Present@plt>
xor    %eax,%eax
call   1130 <IN_ClearKeysDown@plt>
xor    %eax,%eax
call   1090 <IN_WaitButton@plt>
xor    %eax,%eax
call   1070 <US_GetWindowX@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1120 <US_GetWindowW@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1110 <US_GetWindowY@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x70,%edx
call   1100 <VHB_DrawBitmap@plt>
xor    %eax,%eax
call   10b0 <VL_Present@plt>
xor    %eax,%eax
call   1130 <IN_ClearKeysDown@plt>
xor    %eax,%eax
call   1090 <IN_WaitButton@plt>
xor    %eax,%eax
pop    %rbx
jmp    10d0 <CA_DownLevel@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Cool! I can breathe\0Aunder water now!\00"
define void @CK4_ShowWetsuitMessage() {
%1 = call i32 (...) @SD_WaitSoundDone()
%2 = call i32 (...) @CA_UpLevel()
%3 = call i32 @CA_MarkGrChunk(i32 111)
%4 = call i32 @CA_MarkGrChunk(i32 112)
%5 = call i32 @CA_CacheMarks(i32 0)
%6 = call i32 @US_CenterWindow(i32 26, i32 8)
%7 = call i64 (...) @US_GetWindowX()
%8 = call i64 (...) @US_GetWindowW()
%9 = add nsw i64 %7, %8
%10 = sub nsw i64 %9, 48
%11 = call i32 (...) @US_GetWindowY()
%12 = call i32 @VHB_DrawBitmap(i64 %10, i32 %11, i32 111)
%13 = call i64 (...) @US_GetWindowW()
%14 = sub nsw i64 %13, 48
%15 = call i32 @US_SetWindowW(i64 %14)
%16 = call i64 (...) @US_GetPrintY()
%17 = add nsw i64 %16, 12
%18 = call i32 @US_SetPrintY(i64 %17)
%19 = call i32 @US_CPrint(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (...) @VL_Present()
%21 = call i32 (...) @IN_ClearKeysDown()
%22 = call i32 (...) @IN_WaitButton()
%23 = call i64 (...) @US_GetWindowX()
%24 = call i64 (...) @US_GetWindowW()
%25 = add nsw i64 %23, %24
%26 = call i32 (...) @US_GetWindowY()
%27 = call i32 @VHB_DrawBitmap(i64 %25, i32 %26, i32 112)
%28 = call i32 (...) @VL_Present()
%29 = call i32 (...) @IN_ClearKeysDown()
%30 = call i32 (...) @IN_WaitButton()
%31 = call i32 (...) @CA_DownLevel()
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Cool! I can breathe\0Aunder water now!\00"
define void @CK4_ShowWetsuitMessage() {
%1 = tail call i32 (...) @SD_WaitSoundDone()
%2 = tail call i32 (...) @CA_UpLevel()
%3 = tail call i32 @CA_MarkGrChunk(i32 111)
%4 = tail call i32 @CA_MarkGrChunk(i32 112)
%5 = tail call i32 @CA_CacheMarks(i32 0)
%6 = tail call i32 @US_CenterWindow(i32 26, i32 8)
%7 = tail call i64 (...) @US_GetWindowX()
%8 = tail call i64 (...) @US_GetWindowW()
%9 = add i64 %7, -48
%10 = add i64 %9, %8
%11 = tail call i32 (...) @US_GetWindowY()
%12 = tail call i32 @VHB_DrawBitmap(i64 %10, i32 %11, i32 111)
%13 = tail call i64 (...) @US_GetWindowW()
%14 = add nsw i64 %13, -48
%15 = tail call i32 @US_SetWindowW(i64 %14)
%16 = tail call i64 (...) @US_GetPrintY()
%17 = add nsw i64 %16, 12
%18 = tail call i32 @US_SetPrintY(i64 %17)
%19 = tail call i32 @US_CPrint(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 (...) @VL_Present()
%21 = tail call i32 (...) @IN_ClearKeysDown()
%22 = tail call i32 (...) @IN_WaitButton()
%23 = tail call i64 (...) @US_GetWindowX()
%24 = tail call i64 (...) @US_GetWindowW()
%25 = add nsw i64 %24, %23
%26 = tail call i32 (...) @US_GetWindowY()
%27 = tail call i32 @VHB_DrawBitmap(i64 %25, i32 %26, i32 112)
%28 = tail call i32 (...) @VL_Present()
%29 = tail call i32 (...) @IN_ClearKeysDown()
%30 = tail call i32 (...) @IN_WaitButton()
%31 = tail call i32 (...) @CA_DownLevel()
ret void
}