#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 termios2 {
  int c_iflag;
  int c_lflag;
  int c_cflag;
  int *c_cc;
  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 IGNPAR;
int INLCR;
int INPCK;
int ISIG;
int ISTRIP;
int IXOFF;
int IXON;
int /*<<< orphan*/ OPOST;
int PARENB;
int PARMRK;
size_t VMIN;
size_t VTIME;
void setraw(struct termios2 *t2) {
  t2->c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP | INLCR |
                   IGNCR | ICRNL | IXON | IXOFF);
  t2->c_oflag &= ~OPOST;
  t2->c_lflag &= ~(ISIG | ICANON | ECHO | ECHONL | IEXTEN);
  t2->c_cflag &= ~(CSIZE | PARENB);
  t2->c_cflag |= CS8;
  t2->c_cc[VTIME] = 0;
  t2->c_cc[VMIN] = 1;
}


x86 assembly (clang, -O0):
<setraw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2e41(%rip),%rax
mov    (%rax),%ecx
mov    0x2e80(%rip),%rax
or     (%rax),%ecx
mov    0x2e1f(%rip),%rax
or     (%rax),%ecx
mov    0x2ec6(%rip),%rax
or     (%rax),%ecx
mov    0x2e35(%rip),%rax
or     (%rax),%ecx
mov    0x2e24(%rip),%rax
or     (%rax),%ecx
mov    0x2e93(%rip),%rax
or     (%rax),%ecx
mov    0x2e7a(%rip),%rax
or     (%rax),%ecx
mov    0x2e89(%rip),%rax
or     (%rax),%ecx
mov    0x2e58(%rip),%rax
or     (%rax),%ecx
mov    0x2e67(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2e43(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
mov    0x2e0d(%rip),%rax
mov    (%rax),%ecx
mov    0x2d9c(%rip),%rax
or     (%rax),%ecx
mov    0x2e03(%rip),%rax
or     (%rax),%ecx
mov    0x2daa(%rip),%rax
or     (%rax),%ecx
mov    0x2dc1(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
mov    0x2db3(%rip),%rax
mov    (%rax),%ecx
mov    0x2dda(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    0x2da4(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
or     0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x2d41(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x2d68(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setraw>:
mov    0x2e49(%rip),%rcx
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    0x2e27(%rip),%rcx
or     (%rcx),%eax
mov    0x2ece(%rip),%rcx
or     (%rcx),%eax
mov    0x2e3d(%rip),%rcx
or     (%rcx),%eax
mov    0x2e2c(%rip),%rcx
or     (%rcx),%eax
mov    0x2e9b(%rip),%rcx
or     (%rcx),%eax
mov    0x2e82(%rip),%rcx
or     (%rcx),%eax
mov    0x2e91(%rip),%rcx
or     (%rcx),%eax
mov    0x2e60(%rip),%rcx
or     (%rcx),%eax
mov    0x2e6f(%rip),%rcx
or     (%rcx),%eax
not    %eax
and    %eax,(%rdi)
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x18(%rdi)
mov    0x2e24(%rip),%rax
mov    0x2db5(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2e1a(%rip),%rax
or     (%rax),%ecx
mov    0x2dc1(%rip),%rax
or     (%rax),%ecx
mov    0x2dd8(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x4(%rdi)
mov    0x2dd2(%rip),%rax
mov    0x2dfb(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
not    %ecx
and    0x8(%rdi),%ecx
mov    0x2dcb(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x8(%rdi)
mov    0x10(%rdi),%rax
mov    0x2d73(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2da2(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
ret

LLVM IR (-O0):
%struct.termios2 = type { i32, i32, i32, i32*, i32 }
@IGNBRK = global i32 0
@BRKINT = global i32 0
@IGNPAR = global i32 0
@PARMRK = global i32 0
@INPCK = global i32 0
@ISTRIP = global i32 0
@INLCR = global i32 0
@IGNCR = global i32 0
@ICRNL = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@OPOST = global i32 0
@ISIG = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@IEXTEN = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
define void @setraw(%struct.termios2* %0) {
%2 = alloca %struct.termios2*
store %struct.termios2* %0, %struct.termios2** %2
%3 = load i32, i32* @IGNBRK
%4 = load i32, i32* @BRKINT
%5 = or i32 %3, %4
%6 = load i32, i32* @IGNPAR
%7 = or i32 %5, %6
%8 = load i32, i32* @PARMRK
%9 = or i32 %7, %8
%10 = load i32, i32* @INPCK
%11 = or i32 %9, %10
%12 = load i32, i32* @ISTRIP
%13 = or i32 %11, %12
%14 = load i32, i32* @INLCR
%15 = or i32 %13, %14
%16 = load i32, i32* @IGNCR
%17 = or i32 %15, %16
%18 = load i32, i32* @ICRNL
%19 = or i32 %17, %18
%20 = load i32, i32* @IXON
%21 = or i32 %19, %20
%22 = load i32, i32* @IXOFF
%23 = or i32 %21, %22
%24 = xor i32 %23, -1
%25 = load %struct.termios2*, %struct.termios2** %2
%26 = getelementptr inbounds %struct.termios2, %struct.termios2* %25, i32 0, i32 0
%27 = load i32, i32* %26
%28 = and i32 %27, %24
store i32 %28, i32* %26
%29 = load i32, i32* @OPOST
%30 = xor i32 %29, -1
%31 = load %struct.termios2*, %struct.termios2** %2
%32 = getelementptr inbounds %struct.termios2, %struct.termios2* %31, i32 0, i32 4
%33 = load i32, i32* %32
%34 = and i32 %33, %30
store i32 %34, i32* %32
%35 = load i32, i32* @ISIG
%36 = load i32, i32* @ICANON
%37 = or i32 %35, %36
%38 = load i32, i32* @ECHO
%39 = or i32 %37, %38
%40 = load i32, i32* @ECHONL
%41 = or i32 %39, %40
%42 = load i32, i32* @IEXTEN
%43 = or i32 %41, %42
%44 = xor i32 %43, -1
%45 = load %struct.termios2*, %struct.termios2** %2
%46 = getelementptr inbounds %struct.termios2, %struct.termios2* %45, i32 0, i32 1
%47 = load i32, i32* %46
%48 = and i32 %47, %44
store i32 %48, i32* %46
%49 = load i32, i32* @CSIZE
%50 = load i32, i32* @PARENB
%51 = or i32 %49, %50
%52 = xor i32 %51, -1
%53 = load %struct.termios2*, %struct.termios2** %2
%54 = getelementptr inbounds %struct.termios2, %struct.termios2* %53, i32 0, i32 2
%55 = load i32, i32* %54
%56 = and i32 %55, %52
store i32 %56, i32* %54
%57 = load i32, i32* @CS8
%58 = load %struct.termios2*, %struct.termios2** %2
%59 = getelementptr inbounds %struct.termios2, %struct.termios2* %58, i32 0, i32 2
%60 = load i32, i32* %59
%61 = or i32 %60, %57
store i32 %61, i32* %59
%62 = load %struct.termios2*, %struct.termios2** %2
%63 = getelementptr inbounds %struct.termios2, %struct.termios2* %62, i32 0, i32 3
%64 = load i32*, i32** %63
%65 = load i64, i64* @VTIME
%66 = getelementptr inbounds i32, i32* %64, i64 %65
store i32 0, i32* %66
%67 = load %struct.termios2*, %struct.termios2** %2
%68 = getelementptr inbounds %struct.termios2, %struct.termios2* %67, i32 0, i32 3
%69 = load i32*, i32** %68
%70 = load i64, i64* @VMIN
%71 = getelementptr inbounds i32, i32* %69, i64 %70
store i32 1, i32* %71
ret void
}

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