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

/* Variables and functions */
int /*<<< orphan*/ IEXTEN;
int /*<<< orphan*/ OPOST;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ tcgetattr(int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void disable_extended_io(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~IEXTEN;
  term.c_oflag &= ~OPOST;
  tcsetattr(0, TCSANOW, &term);
}


x86 assembly (clang, -O0):
<disable_extended_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <tcgetattr@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1040 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_extended_io>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <tcgetattr@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0xc(%rsp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x8(%rsp)
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   1040 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

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