#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*/ flushBuffer();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ output(char *);
int /*<<< orphan*/ setLineAlign(int);
int /*<<< orphan*/ startBuffer(int);
void showRules() {
  startBuffer(70);
  setLineAlign(0);
  output("[ RULES ]\n\n");
  setLineAlign(-1);
  output("This a implementation of the famous two player game \"Connect "
         "Four\".\nSo you'll need a friend to play this game :) To win you "
         "simply have to\nconnect four of your chips in a row. This row can be "
         "horizontal,\nvertical or diagonal,it doesn't matter as long as there "
         "are no \"enemy\"\nchips between your chips.\nThe game will "
         "automatically end if one you won and take you to the\n\"Hall of "
         "Shame\"\n\n");
  setLineAlign(0);
  output("[ Press any key to return to main menu ]\n");
  flushBuffer();
  getch();
}


x86 assembly (clang, -O0):
<showRules>:
push   %rbp
mov    %rsp,%rbp
mov    $0x46,%edi
call   1030 <startBuffer@plt>
xor    %edi,%edi
call   1070 <setLineAlign@plt>
lea    0xe94(%rip),%rdi
call   1040 <output@plt>
mov    $0xffffffff,%edi
call   1070 <setLineAlign@plt>
lea    0xe8a(%rip),%rdi
call   1040 <output@plt>
xor    %edi,%edi
call   1070 <setLineAlign@plt>
lea    0xff9(%rip),%rdi
call   1040 <output@plt>
mov    $0x0,%al
call   1050 <flushBuffer@plt>
mov    $0x0,%al
call   1060 <getch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<showRules>:
push   %rax
mov    $0x46,%edi
call   1030 <startBuffer@plt>
xor    %edi,%edi
call   1070 <setLineAlign@plt>
lea    0xe97(%rip),%rdi
call   1040 <output@plt>
mov    $0xffffffff,%edi
call   1070 <setLineAlign@plt>
lea    0xe8d(%rip),%rdi
call   1040 <output@plt>
xor    %edi,%edi
call   1070 <setLineAlign@plt>
lea    0xffc(%rip),%rdi
call   1040 <output@plt>
xor    %eax,%eax
call   1050 <flushBuffer@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <getch@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"[ RULES ]\0A\0A\00"
@.str.1 = [386 x i8] c"This a implementation of the famous two player game \22Connect Four\22.\0ASo you'll need a friend to play this game :) To win you simply have to\0Aconnect four of your chips in a row. This row can be horizontal,\0Avertical or diagonal,it doesn't matter as long as there are no \22enemy\22\0Achips between your chips.\0AThe game will automatically end if one you won and take you to the\0A\22Hall of Shame\22\0A\0A\00"
@.str.2 = [42 x i8] c"[ Press any key to return to main menu ]\0A\00"
define void @showRules() {
%1 = call i32 @startBuffer(i32 70)
%2 = call i32 @setLineAlign(i32 0)
%3 = call i32 @output(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @setLineAlign(i32 -1)
%5 = call i32 @output(i8* getelementptr inbounds ([386 x i8], [386 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @setLineAlign(i32 0)
%7 = call i32 @output(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (...) @flushBuffer()
%9 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"[ RULES ]\0A\0A\00"
@.str.1 = [386 x i8] c"This a implementation of the famous two player game \22Connect Four\22.\0ASo you'll need a friend to play this game :) To win you simply have to\0Aconnect four of your chips in a row. This row can be horizontal,\0Avertical or diagonal,it doesn't matter as long as there are no \22enemy\22\0Achips between your chips.\0AThe game will automatically end if one you won and take you to the\0A\22Hall of Shame\22\0A\0A\00"
@.str.2 = [42 x i8] c"[ Press any key to return to main menu ]\0A\00"
define void @showRules() {
%1 = tail call i32 @startBuffer(i32 70)
%2 = tail call i32 @setLineAlign(i32 0)
%3 = tail call i32 @output(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @setLineAlign(i32 -1)
%5 = tail call i32 @output(i8* getelementptr inbounds ([386 x i8], [386 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @setLineAlign(i32 0)
%7 = tail call i32 @output(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @flushBuffer()
%9 = tail call i32 (...) @getch()
ret void
}