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

/* Variables and functions */
int BRKINT;
int CS8;
int CSIZE;
int ECHO;
int ECHONL;
int ICANON;
int ICRNL;
int IEXTEN;
int IGNBRK;
int IGNCR;
int INLCR;
int ISIG;
int ISTRIP;
int IXON;
int /*<<< orphan*/ OPOST;
int PARENB;
int PARMRK;
void makeraw(struct termios *termios_p) {
  termios_p->c_iflag &=
      ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
  termios_p->c_oflag &= ~OPOST;
  termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
  termios_p->c_cflag &= ~(CSIZE | PARENB);
  termios_p->c_cflag |= CS8;
}


x86 assembly (clang, -O0):
<makeraw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%ecx
mov    0x2e88(%rip),%rax
or     (%rax),%ecx
mov    0x2ecf(%rip),%rax
or     (%rax),%ecx
mov    0x2e4e(%rip),%rax
or     (%rax),%ecx
mov    0x2ea5(%rip),%rax
or     (%rax),%ecx
mov    0x2e94(%rip),%rax
or     (%rax),%ecx
mov    0x2e9b(%rip),%rax
or     (%rax),%ecx
mov    0x2e72(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2e66(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0xc(%rax),%ecx
mov    %ecx,0xc(%rax)
mov    0x2e38(%rip),%rax
mov    (%rax),%ecx
mov    0x2def(%rip),%rax
or     (%rax),%ecx
mov    0x2dd6(%rip),%rax
or     (%rax),%ecx
mov    0x2e15(%rip),%rax
or     (%rax),%ecx
mov    0x2dec(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
mov    0x2dde(%rip),%rax
mov    (%rax),%ecx
mov    0x2dfd(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    0x2dc7(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
or     0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeraw>:
mov    0x2e61(%rip),%rax
mov    0x2e92(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2ed7(%rip),%rax
or     (%rax),%ecx
mov    0x2e56(%rip),%rax
or     (%rax),%ecx
mov    0x2ead(%rip),%rax
or     (%rax),%ecx
mov    0x2e9c(%rip),%rax
or     (%rax),%ecx
mov    0x2ea3(%rip),%rax
or     (%rax),%ecx
mov    0x2e7a(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,(%rdi)
mov    0x2e75(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0xc(%rdi)
mov    0x2e4f(%rip),%rax
mov    0x2e08(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2ded(%rip),%rax
or     (%rax),%ecx
mov    0x2e2c(%rip),%rax
or     (%rax),%ecx
mov    0x2e03(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x4(%rdi)
mov    0x2dfd(%rip),%rax
mov    0x2e1e(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
not    %ecx
and    0x8(%rdi),%ecx
mov    0x2dee(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x8(%rdi)
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i32 }
@IGNBRK = global i32 0
@BRKINT = global i32 0
@PARMRK = global i32 0
@ISTRIP = global i32 0
@INLCR = global i32 0
@IGNCR = global i32 0
@ICRNL = global i32 0
@IXON = global i32 0
@OPOST = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@ICANON = global i32 0
@ISIG = global i32 0
@IEXTEN = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
define void @makeraw(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load i32, i32* @IGNBRK
%4 = load i32, i32* @BRKINT
%5 = or i32 %3, %4
%6 = load i32, i32* @PARMRK
%7 = or i32 %5, %6
%8 = load i32, i32* @ISTRIP
%9 = or i32 %7, %8
%10 = load i32, i32* @INLCR
%11 = or i32 %9, %10
%12 = load i32, i32* @IGNCR
%13 = or i32 %11, %12
%14 = load i32, i32* @ICRNL
%15 = or i32 %13, %14
%16 = load i32, i32* @IXON
%17 = or i32 %15, %16
%18 = xor i32 %17, -1
%19 = load %struct.termios*, %struct.termios** %2
%20 = getelementptr inbounds %struct.termios, %struct.termios* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = and i32 %21, %18
store i32 %22, i32* %20
%23 = load i32, i32* @OPOST
%24 = xor i32 %23, -1
%25 = load %struct.termios*, %struct.termios** %2
%26 = getelementptr inbounds %struct.termios, %struct.termios* %25, i32 0, i32 3
%27 = load i32, i32* %26
%28 = and i32 %27, %24
store i32 %28, i32* %26
%29 = load i32, i32* @ECHO
%30 = load i32, i32* @ECHONL
%31 = or i32 %29, %30
%32 = load i32, i32* @ICANON
%33 = or i32 %31, %32
%34 = load i32, i32* @ISIG
%35 = or i32 %33, %34
%36 = load i32, i32* @IEXTEN
%37 = or i32 %35, %36
%38 = xor i32 %37, -1
%39 = load %struct.termios*, %struct.termios** %2
%40 = getelementptr inbounds %struct.termios, %struct.termios* %39, i32 0, i32 1
%41 = load i32, i32* %40
%42 = and i32 %41, %38
store i32 %42, i32* %40
%43 = load i32, i32* @CSIZE
%44 = load i32, i32* @PARENB
%45 = or i32 %43, %44
%46 = xor i32 %45, -1
%47 = load %struct.termios*, %struct.termios** %2
%48 = getelementptr inbounds %struct.termios, %struct.termios* %47, i32 0, i32 2
%49 = load i32, i32* %48
%50 = and i32 %49, %46
store i32 %50, i32* %48
%51 = load i32, i32* @CS8
%52 = load %struct.termios*, %struct.termios** %2
%53 = getelementptr inbounds %struct.termios, %struct.termios* %52, i32 0, i32 2
%54 = load i32, i32* %53
%55 = or i32 %54, %51
store i32 %55, i32* %53
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32 }
@IGNBRK = global i32 0
@BRKINT = global i32 0
@PARMRK = global i32 0
@ISTRIP = global i32 0
@INLCR = global i32 0
@IGNCR = global i32 0
@ICRNL = global i32 0
@IXON = global i32 0
@OPOST = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@ICANON = global i32 0
@ISIG = global i32 0
@IEXTEN = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
define void @makeraw(%struct.termios* nocapture %0) {
%2 = load i32, i32* @IGNBRK
%3 = load i32, i32* @BRKINT
%4 = or i32 %3, %2
%5 = load i32, i32* @PARMRK
%6 = or i32 %4, %5
%7 = load i32, i32* @ISTRIP
%8 = or i32 %6, %7
%9 = load i32, i32* @INLCR
%10 = or i32 %8, %9
%11 = load i32, i32* @IGNCR
%12 = or i32 %10, %11
%13 = load i32, i32* @ICRNL
%14 = or i32 %12, %13
%15 = load i32, i32* @IXON
%16 = or i32 %14, %15
%17 = xor i32 %16, -1
%18 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%19 = load i32, i32* %18
%20 = and i32 %19, %17
store i32 %20, i32* %18
%21 = load i32, i32* @OPOST
%22 = xor i32 %21, -1
%23 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 3
%24 = load i32, i32* %23
%25 = and i32 %24, %22
store i32 %25, i32* %23
%26 = load i32, i32* @ECHO
%27 = load i32, i32* @ECHONL
%28 = or i32 %27, %26
%29 = load i32, i32* @ICANON
%30 = or i32 %28, %29
%31 = load i32, i32* @ISIG
%32 = or i32 %30, %31
%33 = load i32, i32* @IEXTEN
%34 = or i32 %32, %33
%35 = xor i32 %34, -1
%36 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
%37 = load i32, i32* %36
%38 = and i32 %37, %35
store i32 %38, i32* %36
%39 = load i32, i32* @CSIZE
%40 = load i32, i32* @PARENB
%41 = or i32 %40, %39
%42 = xor i32 %41, -1
%43 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 2
%44 = load i32, i32* %43
%45 = and i32 %44, %42
%46 = load i32, i32* @CS8
%47 = or i32 %46, %45
store i32 %47, i32* %43
ret void
}