#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 */
struct termios {
  int *c_cc;
  int /*<<< orphan*/ c_lflag;
};

/* Variables and functions */
int /*<<< orphan*/ ICANON;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ tcgetattr(int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void pauseProgram() {
  printf("\033[1m\033[37m"
         "Press any key to continue..."
         "\033[0m");
  struct termios info;
  tcgetattr(0, &info);
  info.c_lflag &= ~ICANON;
  info.c_cc[VMIN] = 1;
  info.c_cc[VTIME] = 0;
  tcsetattr(0, TCSANOW, &info);
  getchar();
  printf("\n");
}


x86 assembly (clang, -O0):
<pauseProgram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
lea    -0x10(%rbp),%rsi
call   1050 <tcgetattr@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2e64(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    0x2e3f(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2e46(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x10(%rbp),%rdx
call   1060 <tcsetattr@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pauseProgram>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <tcgetattr@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x8(%rsp)
mov    (%rsp),%rax
mov    0x2e58(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2e37(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   1070 <tcsetattr@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.termios = type { i32*, i32 }
@.str = [42 x i8] c"\1B[1m\1B[37mPress any key to continue...\1B[0m\00"
@ICANON = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @pauseProgram() {
%1 = alloca %struct.termios
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @tcgetattr(i32 0, %struct.termios* %1)
%4 = load i32, i32* @ICANON
%5 = xor i32 %4, -1
%6 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = and i32 %7, %5
store i32 %8, i32* %6
%9 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%10 = load i32*, i32** %9
%11 = load i64, i64* @VMIN
%12 = getelementptr inbounds i32, i32* %10, i64 %11
store i32 1, i32* %12
%13 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%14 = load i32*, i32** %13
%15 = load i64, i64* @VTIME
%16 = getelementptr inbounds i32, i32* %14, i64 %15
store i32 0, i32* %16
%17 = load i32, i32* @TCSANOW
%18 = call i32 @tcsetattr(i32 0, i32 %17, %struct.termios* %1)
%19 = call i32 (...) @getchar()
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32*, i32 }
@.str = [42 x i8] c"\1B[1m\1B[37mPress any key to continue...\1B[0m\00"
@ICANON = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
define void @pauseProgram() {
%1 = alloca %struct.termios
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = bitcast %struct.termios* %1 to i8*
%4 = call i32 @tcgetattr(i32 0, %struct.termios* %1)
%5 = load i32, i32* @ICANON
%6 = xor i32 %5, -1
%7 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = and i32 %8, %6
store i32 %9, i32* %7
%10 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%11 = load i32*, i32** %10
%12 = load i64, i64* @VMIN
%13 = getelementptr inbounds i32, i32* %11, i64 %12
store i32 1, i32* %13
%14 = load i64, i64* @VTIME
%15 = getelementptr inbounds i32, i32* %11, i64 %14
store i32 0, i32* %15
%16 = load i32, i32* @TCSANOW
%17 = call i32 @tcsetattr(i32 0, i32 %16, %struct.termios* %1)
%18 = call i32 (...) @getchar()
%19 = call i32 @putchar(i32 10)
ret void
}