#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 /*<<< orphan*/ c_oflag;
};

/* Variables and functions */
int /*<<< orphan*/ B115200;
int BRKINT;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int CSIZE;
int CSTOPB;
int ECHO;
int ECHOE;
int ECHOK;
int ECHONL;
int ICANON;
int ICRNL;
int IGNPAR;
int INLCR;
int INPCK;
int ISIG;
int ISTRIP;
int IUCLC;
int IXANY;
int IXOFF;
int IXON;
int /*<<< orphan*/ OPOST;
int PARENB;
int PARMRK;
int /*<<< orphan*/ cfsetispeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ cfsetospeed(struct termios *, int /*<<< orphan*/);
void copynes_configure_tios(struct termios *tios) {
  cfsetispeed(tios, B115200);
  cfsetospeed(tios, B115200);
  tios->c_cflag |= (CLOCAL | CREAD);
  tios->c_cflag &= ~PARENB;
  tios->c_cflag &= ~CSTOPB;
  tios->c_cflag &= ~CSIZE;
  tios->c_cflag |= CS8;
  tios->c_cflag |= CRTSCTS;
  tios->c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG);
  tios->c_iflag &= ~(INPCK | IGNPAR | PARMRK | ISTRIP | IXON | IXOFF | IXANY |
                     ICRNL | INLCR | IUCLC | BRKINT);
  tios->c_oflag &= ~OPOST;
}


x86 assembly (clang, -O0):
<copynes_configure_tios>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
call   1040 <cfsetispeed@plt>
mov    -0x8(%rbp),%rdi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
call   1030 <cfsetospeed@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%ecx
mov    0x2e30(%rip),%rax
or     (%rax),%ecx
mov    -0x8(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2e47(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2d93(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2de7(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2ddb(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2d62(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2d61(%rip),%rax
mov    (%rax),%ecx
mov    0x2dd8(%rip),%rax
or     (%rax),%ecx
mov    0x2dc7(%rip),%rax
or     (%rax),%ecx
mov    0x2d76(%rip),%rax
or     (%rax),%ecx
mov    0x2d5d(%rip),%rax
or     (%rax),%ecx
mov    0x2da4(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
mov    0x2d56(%rip),%rax
mov    (%rax),%ecx
mov    0x2d25(%rip),%rax
or     (%rax),%ecx
mov    0x2dcc(%rip),%rax
or     (%rax),%ecx
mov    0x2d2b(%rip),%rax
or     (%rax),%ecx
mov    0x2d8a(%rip),%rax
or     (%rax),%ecx
mov    0x2d91(%rip),%rax
or     (%rax),%ecx
mov    0x2d28(%rip),%rax
or     (%rax),%ecx
mov    0x2d8f(%rip),%rax
or     (%rax),%ecx
mov    0x2d7e(%rip),%rax
or     (%rax),%ecx
mov    0x2cd5(%rip),%rax
or     (%rax),%ecx
mov    0x2d2c(%rip),%rax
or     (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    0x2d46(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    0xc(%rax),%ecx
mov    %ecx,0xc(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copynes_configure_tios>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e1a(%rip),%r14
mov    (%r14),%esi
call   1040 <cfsetispeed@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <cfsetospeed@plt>
mov    0x2dc8(%rip),%rax
mov    0x2e41(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
or     (%rbx),%ecx
mov    %ecx,(%rbx)
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %ecx,%eax
mov    %eax,(%rbx)
mov    0x2dab(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %eax,%ecx
mov    %ecx,(%rbx)
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %ecx,%eax
mov    %eax,(%rbx)
mov    0x2dfd(%rip),%rcx
or     (%rcx),%eax
mov    %eax,(%rbx)
mov    0x2d8a(%rip),%rcx
or     (%rcx),%eax
mov    %eax,(%rbx)
mov    0x2d8f(%rip),%rax
mov    0x2e08(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2df5(%rip),%rax
or     (%rax),%ecx
mov    0x2da4(%rip),%rax
or     (%rax),%ecx
mov    0x2d8b(%rip),%rax
or     (%rax),%ecx
mov    0x2dd2(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x4(%rbx)
mov    0x2d8c(%rip),%rcx
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    0x2e02(%rip),%rcx
or     (%rcx),%eax
mov    0x2d61(%rip),%rcx
or     (%rcx),%eax
mov    0x2dc0(%rip),%rcx
or     (%rcx),%eax
mov    0x2dc7(%rip),%rcx
or     (%rcx),%eax
mov    0x2d5e(%rip),%rcx
or     (%rcx),%eax
mov    0x2dc5(%rip),%rcx
or     (%rcx),%eax
mov    0x2db4(%rip),%rcx
or     (%rcx),%eax
mov    0x2d0b(%rip),%rcx
or     (%rcx),%eax
mov    0x2d62(%rip),%rcx
or     (%rcx),%eax
not    %eax
and    %eax,0x8(%rbx)
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32 }
@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
@ECHOK = global i32 0
@ECHONL = global i32 0
@ISIG = global i32 0
@INPCK = global i32 0
@IGNPAR = global i32 0
@PARMRK = global i32 0
@ISTRIP = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@IUCLC = global i32 0
@BRKINT = global i32 0
@OPOST = global i32 0
define void @copynes_configure_tios(%struct.termios* %0) {
%2 = load i32, i32* @B115200
%3 = tail call i32 @cfsetispeed(%struct.termios* %0, i32 %2)
%4 = load i32, i32* @B115200
%5 = tail call i32 @cfsetospeed(%struct.termios* %0, i32 %4)
%6 = load i32, i32* @CLOCAL
%7 = load i32, i32* @CREAD
%8 = or i32 %7, %6
%9 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%10 = load i32, i32* %9
%11 = or i32 %8, %10
store i32 %11, i32* %9
%12 = load i32, i32* @PARENB
%13 = xor i32 %12, -1
%14 = and i32 %11, %13
store i32 %14, i32* %9
%15 = load i32, i32* @CSTOPB
%16 = xor i32 %15, -1
%17 = and i32 %14, %16
store i32 %17, i32* %9
%18 = load i32, i32* @CSIZE
%19 = xor i32 %18, -1
%20 = and i32 %17, %19
store i32 %20, i32* %9
%21 = load i32, i32* @CS8
%22 = or i32 %21, %20
store i32 %22, i32* %9
%23 = load i32, i32* @CRTSCTS
%24 = or i32 %23, %22
store i32 %24, i32* %9
%25 = load i32, i32* @ICANON
%26 = load i32, i32* @ECHO
%27 = or i32 %26, %25
%28 = load i32, i32* @ECHOE
%29 = or i32 %27, %28
%30 = load i32, i32* @ECHOK
%31 = or i32 %29, %30
%32 = load i32, i32* @ECHONL
%33 = or i32 %31, %32
%34 = load i32, i32* @ISIG
%35 = or i32 %33, %34
%36 = xor i32 %35, -1
%37 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
%38 = load i32, i32* %37
%39 = and i32 %38, %36
store i32 %39, i32* %37
%40 = load i32, i32* @INPCK
%41 = load i32, i32* @IGNPAR
%42 = or i32 %41, %40
%43 = load i32, i32* @PARMRK
%44 = or i32 %42, %43
%45 = load i32, i32* @ISTRIP
%46 = or i32 %44, %45
%47 = load i32, i32* @IXON
%48 = or i32 %46, %47
%49 = load i32, i32* @IXOFF
%50 = or i32 %48, %49
%51 = load i32, i32* @IXANY
%52 = or i32 %50, %51
%53 = load i32, i32* @ICRNL
%54 = or i32 %52, %53
%55 = load i32, i32* @INLCR
%56 = or i32 %54, %55
%57 = load i32, i32* @IUCLC
%58 = or i32 %56, %57
%59 = load i32, i32* @BRKINT
%60 = or i32 %58, %59
%61 = xor i32 %60, -1
%62 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 2
%63 = load i32, i32* %62
%64 = and i32 %63, %61
store i32 %64, i32* %62
%65 = load i32, i32* @OPOST
%66 = xor i32 %65, -1
%67 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 3
%68 = load i32, i32* %67
%69 = and i32 %68, %66
store i32 %69, i32* %67
ret void
}