#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_cflag;
  int c_lflag;
  int c_iflag;
  int c_oflag;
  scalar_t__ *c_cc;
};

/* Variables and functions */
int /*<<< orphan*/ B115200;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int CSIZE;
int CSTOPB;
int ECHO;
int ECHOE;
int ICANON;
int ICRNL;
int IGNCR;
int INLCR;
int ISIG;
int IXANY;
int IXOFF;
int IXON;
int NOFLSH;
int OCRNL;
int ONLCR;
int ONLRET;
int OPOST;
int PARENB;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
int TOSTOP;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ cfsetispeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
void termConfigRaw(int fd) {
  struct termios newtio;
  tcgetattr(fd, &newtio);
  cfsetispeed(&newtio, B115200);
  cfsetospeed(&newtio, B115200);
  newtio.c_cflag |= (CLOCAL | CREAD);
  newtio.c_cflag &= ~PARENB;
  newtio.c_cflag &= ~CSTOPB;
  newtio.c_cflag &= ~CSIZE;
  newtio.c_cflag |= CS8;
  newtio.c_cflag &= ~CRTSCTS;
  newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG | NOFLSH | TOSTOP);
  newtio.c_lflag = 0;
  newtio.c_iflag &= ~(IXON | IXOFF | IXANY | ICRNL | INLCR | IGNCR);
  newtio.c_oflag &= ~(OPOST | ONLCR | OCRNL | ONLRET);
  newtio.c_cc[VTIME] = 0;
  newtio.c_cc[VMIN] = 0;
  tcflush(fd, TCIFLUSH);
  tcsetattr(fd, TCSANOW, &newtio);
}


x86 assembly (clang, -O0):
<termConfigRaw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1050 <tcgetattr@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdi
call   1070 <cfsetispeed@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    0x2de5(%rip),%rcx
or     (%rcx),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d4c(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d21(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d1f(%rip),%rax
mov    (%rax),%eax
mov    0x2d8e(%rip),%rcx
or     (%rcx),%eax
mov    0x2d7d(%rip),%rcx
or     (%rcx),%eax
mov    0x2d6c(%rip),%rcx
or     (%rcx),%eax
mov    0x2d3b(%rip),%rcx
or     (%rcx),%eax
mov    0x2db2(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2d69(%rip),%rax
mov    (%rax),%eax
mov    0x2d78(%rip),%rcx
or     (%rcx),%eax
mov    0x2cf7(%rip),%rcx
or     (%rcx),%eax
mov    0x2d76(%rip),%rcx
or     (%rcx),%eax
mov    0x2d65(%rip),%rcx
or     (%rcx),%eax
mov    0x2d4c(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
mov    0x2ca9(%rip),%rcx
or     (%rcx),%eax
mov    0x2d58(%rip),%rcx
or     (%rcx),%eax
mov    0x2c87(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2c79(%rip),%rcx
mov    (%rcx),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    0x2ca3(%rip),%rcx
mov    (%rcx),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x4(%rbp),%edi
mov    0x2c66(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
mov    -0x4(%rbp),%edi
mov    0x2cad(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1060 <tcsetattr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termConfigRaw>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebp
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1050 <tcgetattr@plt>
mov    0x2dfa(%rip),%rbx
mov    (%rbx),%esi
mov    %r14,%rdi
call   1070 <cfsetispeed@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <cfsetospeed@plt>
mov    0x2da7(%rip),%rax
mov    0x2e10(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
or     0x8(%rsp),%ecx
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
mov    0x2d90(%rip),%rdx
or     (%rdx),%eax
mov    0x2dd7(%rip),%rdx
or     (%rdx),%eax
not    %eax
and    %ecx,%eax
mov    0x2dda(%rip),%rcx
or     (%rcx),%eax
mov    0x2df1(%rip),%rcx
mov    0x2e02(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2d67(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %eax,%ecx
mov    0x2d92(%rip),%rax
or     (%rax),%edx
mov    %ecx,0x8(%rsp)
mov    0x2ded(%rip),%rax
or     (%rax),%edx
movl   $0x0,0xc(%rsp)
mov    0x2dd4(%rip),%rax
or     (%rax),%edx
mov    0x2dbb(%rip),%rax
or     (%rax),%edx
not    %edx
and    %edx,0x10(%rsp)
mov    0x2da4(%rip),%rax
mov    0x2d3d(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2dc2(%rip),%rax
or     (%rax),%ecx
mov    0x2d19(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x14(%rsp)
mov    0x18(%rsp),%rax
mov    0x2d0d(%rip),%rcx
mov    (%rcx),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    0x2d33(%rip),%rcx
mov    (%rcx),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    0x2d01(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1040 <tcflush@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r14,%rdx
call   1060 <tcsetattr@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i32, i64* }
@B115200 = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@PARENB = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOE = global i32 0
@ISIG = global i32 0
@NOFLSH = global i32 0
@TOSTOP = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@IGNCR = global i32 0
@OPOST = global i32 0
@ONLCR = global i32 0
@OCRNL = global i32 0
@ONLRET = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
define void @termConfigRaw(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.termios
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @tcgetattr(i32 %4, %struct.termios* %3)
%6 = load i32, i32* @B115200
%7 = call i32 @cfsetispeed(%struct.termios* %3, i32 %6)
%8 = load i32, i32* @B115200
%9 = call i32 @cfsetospeed(%struct.termios* %3, i32 %8)
%10 = load i32, i32* @CLOCAL
%11 = load i32, i32* @CREAD
%12 = or i32 %10, %11
%13 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%14 = load i32, i32* %13
%15 = or i32 %14, %12
store i32 %15, i32* %13
%16 = load i32, i32* @PARENB
%17 = xor i32 %16, -1
%18 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%19 = load i32, i32* %18
%20 = and i32 %19, %17
store i32 %20, i32* %18
%21 = load i32, i32* @CSTOPB
%22 = xor i32 %21, -1
%23 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%24 = load i32, i32* %23
%25 = and i32 %24, %22
store i32 %25, i32* %23
%26 = load i32, i32* @CSIZE
%27 = xor i32 %26, -1
%28 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%29 = load i32, i32* %28
%30 = and i32 %29, %27
store i32 %30, i32* %28
%31 = load i32, i32* @CS8
%32 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%33 = load i32, i32* %32
%34 = or i32 %33, %31
store i32 %34, i32* %32
%35 = load i32, i32* @CRTSCTS
%36 = xor i32 %35, -1
%37 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%38 = load i32, i32* %37
%39 = and i32 %38, %36
store i32 %39, i32* %37
%40 = load i32, i32* @ICANON
%41 = load i32, i32* @ECHO
%42 = or i32 %40, %41
%43 = load i32, i32* @ECHOE
%44 = or i32 %42, %43
%45 = load i32, i32* @ISIG
%46 = or i32 %44, %45
%47 = load i32, i32* @NOFLSH
%48 = or i32 %46, %47
%49 = load i32, i32* @TOSTOP
%50 = or i32 %48, %49
%51 = xor i32 %50, -1
%52 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 1
%53 = load i32, i32* %52
%54 = and i32 %53, %51
store i32 %54, i32* %52
%55 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 1
store i32 0, i32* %55
%56 = load i32, i32* @IXON
%57 = load i32, i32* @IXOFF
%58 = or i32 %56, %57
%59 = load i32, i32* @IXANY
%60 = or i32 %58, %59
%61 = load i32, i32* @ICRNL
%62 = or i32 %60, %61
%63 = load i32, i32* @INLCR
%64 = or i32 %62, %63
%65 = load i32, i32* @IGNCR
%66 = or i32 %64, %65
%67 = xor i32 %66, -1
%68 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 2
%69 = load i32, i32* %68
%70 = and i32 %69, %67
store i32 %70, i32* %68
%71 = load i32, i32* @OPOST
%72 = load i32, i32* @ONLCR
%73 = or i32 %71, %72
%74 = load i32, i32* @OCRNL
%75 = or i32 %73, %74
%76 = load i32, i32* @ONLRET
%77 = or i32 %75, %76
%78 = xor i32 %77, -1
%79 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 3
%80 = load i32, i32* %79
%81 = and i32 %80, %78
store i32 %81, i32* %79
%82 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 4
%83 = load i64*, i64** %82
%84 = load i64, i64* @VTIME
%85 = getelementptr inbounds i64, i64* %83, i64 %84
store i64 0, i64* %85
%86 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 4
%87 = load i64*, i64** %86
%88 = load i64, i64* @VMIN
%89 = getelementptr inbounds i64, i64* %87, i64 %88
store i64 0, i64* %89
%90 = load i32, i32* %2
%91 = load i32, i32* @TCIFLUSH
%92 = call i32 @tcflush(i32 %90, i32 %91)
%93 = load i32, i32* %2
%94 = load i32, i32* @TCSANOW
%95 = call i32 @tcsetattr(i32 %93, i32 %94, %struct.termios* %3)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32, i64* }
@B115200 = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@PARENB = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOE = global i32 0
@ISIG = global i32 0
@NOFLSH = global i32 0
@TOSTOP = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@IGNCR = global i32 0
@OPOST = global i32 0
@ONLCR = global i32 0
@OCRNL = global i32 0
@ONLRET = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
define void @termConfigRaw(i32 %0) {
%2 = alloca %struct.termios
%3 = bitcast %struct.termios* %2 to i8*
%4 = call i32 @tcgetattr(i32 %0, %struct.termios* %2)
%5 = load i32, i32* @B115200
%6 = call i32 @cfsetispeed(%struct.termios* %2, i32 %5)
%7 = load i32, i32* @B115200
%8 = call i32 @cfsetospeed(%struct.termios* %2, i32 %7)
%9 = load i32, i32* @CLOCAL
%10 = load i32, i32* @CREAD
%11 = or i32 %10, %9
%12 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 0
%13 = load i32, i32* %12
%14 = or i32 %11, %13
%15 = load i32, i32* @PARENB
%16 = load i32, i32* @CSTOPB
%17 = or i32 %15, %16
%18 = load i32, i32* @CSIZE
%19 = or i32 %17, %18
%20 = xor i32 %19, -1
%21 = and i32 %14, %20
%22 = load i32, i32* @CS8
%23 = or i32 %22, %21
%24 = load i32, i32* @CRTSCTS
%25 = xor i32 %24, -1
%26 = and i32 %23, %25
store i32 %26, i32* %12
%27 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 1
store i32 0, i32* %27
%28 = load i32, i32* @IXON
%29 = load i32, i32* @IXOFF
%30 = or i32 %29, %28
%31 = load i32, i32* @IXANY
%32 = or i32 %30, %31
%33 = load i32, i32* @ICRNL
%34 = or i32 %32, %33
%35 = load i32, i32* @INLCR
%36 = or i32 %34, %35
%37 = load i32, i32* @IGNCR
%38 = or i32 %36, %37
%39 = xor i32 %38, -1
%40 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 2
%41 = load i32, i32* %40
%42 = and i32 %41, %39
store i32 %42, i32* %40
%43 = load i32, i32* @OPOST
%44 = load i32, i32* @ONLCR
%45 = or i32 %44, %43
%46 = load i32, i32* @OCRNL
%47 = or i32 %45, %46
%48 = load i32, i32* @ONLRET
%49 = or i32 %47, %48
%50 = xor i32 %49, -1
%51 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 3
%52 = load i32, i32* %51
%53 = and i32 %52, %50
store i32 %53, i32* %51
%54 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 4
%55 = load i64*, i64** %54
%56 = load i64, i64* @VTIME
%57 = getelementptr inbounds i64, i64* %55, i64 %56
store i64 0, i64* %57
%58 = load i64, i64* @VMIN
%59 = getelementptr inbounds i64, i64* %55, i64 %58
store i64 0, i64* %59
%60 = load i32, i32* @TCIFLUSH
%61 = call i32 @tcflush(i32 %0, i32 %60)
%62 = load i32, i32* @TCSANOW
%63 = call i32 @tcsetattr(i32 %0, i32 %62, %struct.termios* %2)
ret void
}