#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_lflag;
};

/* Variables and functions */
int ECHO;
int ICANON;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ tcgetattr(int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void turnOffLineBuffering() {
  struct termios termiosStruct;
  tcgetattr(STDIN_FILENO, &termiosStruct);
  termiosStruct.c_lflag &= ~(ICANON | ECHO);
  tcsetattr(STDIN_FILENO, TCSANOW, &termiosStruct);
}


x86 assembly (clang, -O0):
<turnOffLineBuffering>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <tcgetattr@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    0x2e96(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1040 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turnOffLineBuffering>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%rbx
mov    (%rbx),%edi
mov    %rsp,%r14
mov    %r14,%rsi
call   1030 <tcgetattr@plt>
mov    0x2e89(%rip),%rax
mov    0x2e9a(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
not    %ecx
and    %ecx,(%rsp)
mov    (%rbx),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdx
call   1040 <tcsetattr@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@STDIN_FILENO = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@TCSANOW = global i32 0
define void @turnOffLineBuffering() {
%1 = alloca %struct.termios
%2 = load i32, i32* @STDIN_FILENO
%3 = call i32 @tcgetattr(i32 %2, %struct.termios* %1)
%4 = load i32, i32* @ICANON
%5 = load i32, i32* @ECHO
%6 = or i32 %4, %5
%7 = xor i32 %6, -1
%8 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%9 = load i32, i32* %8
%10 = and i32 %9, %7
store i32 %10, i32* %8
%11 = load i32, i32* @STDIN_FILENO
%12 = load i32, i32* @TCSANOW
%13 = call i32 @tcsetattr(i32 %11, i32 %12, %struct.termios* %1)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@STDIN_FILENO = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@TCSANOW = global i32 0
define void @turnOffLineBuffering() {
%1 = alloca %struct.termios
%2 = bitcast %struct.termios* %1 to i8*
%3 = load i32, i32* @STDIN_FILENO
%4 = call i32 @tcgetattr(i32 %3, %struct.termios* %1)
%5 = load i32, i32* @ICANON
%6 = load i32, i32* @ECHO
%7 = or i32 %6, %5
%8 = xor i32 %7, -1
%9 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = and i32 %10, %8
store i32 %11, i32* %9
%12 = load i32, i32* @STDIN_FILENO
%13 = load i32, i32* @TCSANOW
%14 = call i32 @tcsetattr(i32 %12, i32 %13, %struct.termios* %1)
ret void
}