#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 /*<<< orphan*/ c_oflag;
  int /*<<< orphan*/ c_iflag;
  int /*<<< orphan*/ c_lflag;
};

/* Variables and functions */
int /*<<< orphan*/ ECHO;
int /*<<< orphan*/ ICANON;
int /*<<< orphan*/ IXON;
int /*<<< orphan*/ OPOST;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ tcgetattr(int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void noraw(void) {
  struct termios it;
  tcgetattr(fileno(stdin), &it);
  it.c_lflag |= ICANON;
  it.c_lflag |= ECHO;
  it.c_iflag |= IXON;
  it.c_oflag |= OPOST;
  tcsetattr(fileno(stdin), TCSANOW, &it);
}


x86 assembly (clang, -O0):
<noraw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1030 <fileno@plt>
mov    %eax,%edi
lea    -0x10(%rbp),%rsi
call   1040 <tcgetattr@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1030 <fileno@plt>
mov    %eax,%edi
mov    0x2e2c(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdx
call   1050 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noraw>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2eaa(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fileno@plt>
lea    0x8(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <tcgetattr@plt>
mov    0x2e5d(%rip),%rax
mov    0x10(%rsp),%ecx
or     (%rax),%ecx
mov    0x2e60(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x10(%rsp)
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
or     %eax,0xc(%rsp)
mov    0x2e5e(%rip),%rax
mov    (%rax),%eax
or     %eax,0x8(%rsp)
mov    (%rbx),%edi
call   1030 <fileno@plt>
mov    0x2e3a(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
mov    %r14,%rdx
call   1050 <tcsetattr@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32 }
@stdin = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@IXON = global i32 0
@OPOST = global i32 0
@TCSANOW = global i32 0
define void @noraw() {
%1 = alloca %struct.termios
%2 = load i32, i32* @stdin
%3 = call i32 @fileno(i32 %2)
%4 = call i32 @tcgetattr(i32 %3, %struct.termios* %1)
%5 = load i32, i32* @ICANON
%6 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 2
%7 = load i32, i32* %6
%8 = or i32 %7, %5
store i32 %8, i32* %6
%9 = load i32, i32* @ECHO
%10 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 2
%11 = load i32, i32* %10
%12 = or i32 %11, %9
store i32 %12, i32* %10
%13 = load i32, i32* @IXON
%14 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%15 = load i32, i32* %14
%16 = or i32 %15, %13
store i32 %16, i32* %14
%17 = load i32, i32* @OPOST
%18 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%19 = load i32, i32* %18
%20 = or i32 %19, %17
store i32 %20, i32* %18
%21 = load i32, i32* @stdin
%22 = call i32 @fileno(i32 %21)
%23 = load i32, i32* @TCSANOW
%24 = call i32 @tcsetattr(i32 %22, i32 %23, %struct.termios* %1)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32 }
@stdin = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@IXON = global i32 0
@OPOST = global i32 0
@TCSANOW = global i32 0
define void @noraw() {
%1 = alloca %struct.termios
%2 = bitcast %struct.termios* %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call i32 @fileno(i32 %3)
%5 = call i32 @tcgetattr(i32 %4, %struct.termios* %1)
%6 = load i32, i32* @ICANON
%7 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 2
%8 = load i32, i32* %7
%9 = or i32 %8, %6
%10 = load i32, i32* @ECHO
%11 = or i32 %10, %9
store i32 %11, i32* %7
%12 = load i32, i32* @IXON
%13 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%14 = load i32, i32* %13
%15 = or i32 %14, %12
store i32 %15, i32* %13
%16 = load i32, i32* @OPOST
%17 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%18 = load i32, i32* %17
%19 = or i32 %18, %16
store i32 %19, i32* %17
%20 = load i32, i32* @stdin
%21 = call i32 @fileno(i32 %20)
%22 = load i32, i32* @TCSANOW
%23 = call i32 @tcsetattr(i32 %21, i32 %22, %struct.termios* %1)
ret void
}