#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_cc;
  int c_iflag;
  int c_oflag;
  int c_lflag;
};

/* Variables and functions */
int CBAUD;
int CBAUDEX;
int CDISCARD;
int CEOF;
int CERASE;
int CINTR;
int CKILL;
int CLNEXT;
int CLOCAL;
int CQUIT;
int CREAD;
int CREPRINT;
int CSIZE;
int CSTART;
int CSTOP;
int CSTOPB;
int CSUSP;
int CWERASE;
int ECHO;
int ECHOCTL;
int ECHOKE;
int ECHOPRT;
int HUPCL;
int ICANON;
int ICRNL;
int IGNPAR;
int ISIG;
int IXANY;
int IXON;
int ONLCR;
int OPOST;
int O_NOCTTY;
int O_RDWR;
int PARENB;
int PARODD;
int /*<<< orphan*/ TCIOFLUSH;
int /*<<< orphan*/ TCSANOW;
size_t VDISCARD;
size_t VEOF;
size_t VEOL;
size_t VEOL2;
size_t VERASE;
size_t VINTR;
size_t VKILL;
size_t VLNEXT;
size_t VMIN;
size_t VQUIT;
size_t VREPRINT;
size_t VSTART;
size_t VSTOP;
size_t VSUSP;
size_t VSWTC;
size_t VTIME;
size_t VWERASE;
void *_POSIX_VDISABLE;
int /*<<< orphan*/ close(int);
int console_open(int);
int /*<<< orphan*/ initlog(char *);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
void console_stty(void) {
  struct termios tty;
  int fd;
  if ((fd = console_open(O_RDWR | O_NOCTTY)) < 0) {
    initlog("can't open console!");
    return;
  }
  (void)tcgetattr(fd, &tty);
  tty.c_cflag &= CBAUD | CBAUDEX | CSIZE | CSTOPB | PARENB | PARODD;
  tty.c_cflag |= HUPCL | CLOCAL | CREAD;
  tty.c_cc[VINTR] = CINTR;
  tty.c_cc[VQUIT] = CQUIT;
  tty.c_cc[VERASE] = CERASE;
  tty.c_cc[VKILL] = CKILL;
  tty.c_cc[VEOF] = CEOF;
  tty.c_cc[VTIME] = 0;
  tty.c_cc[VMIN] = 1;
  tty.c_cc[VSWTC] = _POSIX_VDISABLE;
  tty.c_cc[VSTART] = CSTART;
  tty.c_cc[VSTOP] = CSTOP;
  tty.c_cc[VSUSP] = CSUSP;
  tty.c_cc[VEOL] = _POSIX_VDISABLE;
  tty.c_cc[VREPRINT] = CREPRINT;
  tty.c_cc[VDISCARD] = CDISCARD;
  tty.c_cc[VWERASE] = CWERASE;
  tty.c_cc[VLNEXT] = CLNEXT;
  tty.c_cc[VEOL2] = _POSIX_VDISABLE;
  tty.c_iflag = IGNPAR | ICRNL | IXON | IXANY;
  tty.c_oflag = OPOST | ONLCR;
  tty.c_lflag = ISIG | ICANON | ECHO | ECHOCTL | ECHOPRT | ECHOKE;
  (void)tcsetattr(fd, TCSANOW, &tty);
  (void)tcflush(fd, TCIOFLUSH);
  (void)close(fd);
}


x86 assembly (clang, -O0):
<console_stty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    0x2d68(%rip),%rax
or     (%rax),%edi
call   2040 <console_open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    219c <console_stty+0x3c>
lea    0xe6e(%rip),%rdi
call   2030 <initlog@plt>
jmp    2461 <console_stty+0x301>
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   2070 <tcgetattr@plt>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
mov    0x2d18(%rip),%rcx
or     (%rcx),%eax
mov    0x2d3f(%rip),%rcx
or     (%rcx),%eax
mov    0x2c86(%rip),%rcx
or     (%rcx),%eax
mov    0x2d8d(%rip),%rcx
or     (%rcx),%eax
mov    0x2d64(%rip),%rcx
or     (%rcx),%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2c9d(%rip),%rax
mov    (%rax),%eax
mov    0x2c3c(%rip),%rcx
or     (%rcx),%eax
mov    0x2d13(%rip),%rcx
or     (%rcx),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d2c(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2c3f(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2d92(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2c8d(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2d58(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2d0b(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2c56(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2d39(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2d04(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2ba7(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    0x2c0e(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    0x2c61(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2cd8(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    0x2bc8(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2b6b(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2b56(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2cd9(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2c8c(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2b8f(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2b52(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2c6d(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    0x2b15(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2ca0(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2bd3(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2bce(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2c01(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2ba4(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2c27(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2c42(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x2b3d(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2be8(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    0x2c20(%rip),%rcx
mov    (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2abb(%rip),%rax
mov    (%rax),%eax
mov    0x2bf2(%rip),%rcx
or     (%rcx),%eax
mov    0x2b99(%rip),%rcx
or     (%rcx),%eax
mov    0x2b10(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    0x2b94(%rip),%rax
mov    (%rax),%eax
mov    0x2ab3(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    0x2b2f(%rip),%rax
mov    (%rax),%eax
mov    0x2a6e(%rip),%rcx
or     (%rcx),%eax
mov    0x2b35(%rip),%rcx
or     (%rcx),%eax
mov    0x2b94(%rip),%rcx
or     (%rcx),%eax
mov    0x2a93(%rip),%rcx
or     (%rcx),%eax
mov    0x2aba(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2b13(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   2080 <tcsetattr@plt>
mov    -0x24(%rbp),%edi
mov    0x2a76(%rip),%rax
mov    (%rax),%esi
call   2050 <tcflush@plt>
mov    -0x24(%rbp),%edi
call   2060 <close@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_stty>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2e7a(%rip),%rax
mov    0x2d6b(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   2040 <console_open@plt>
test   %eax,%eax
js     23f9 <console_stty+0x299>
mov    %eax,%ebx
lea    0x8(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rsi
call   2070 <tcgetattr@plt>
mov    0x2cc2(%rip),%rax
mov    0x2d2b(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2d50(%rip),%rax
or     (%rax),%ecx
mov    0x2c97(%rip),%rax
or     (%rax),%ecx
mov    0x2d9e(%rip),%rax
or     (%rax),%ecx
mov    0x2d75(%rip),%rax
or     (%rax),%ecx
and    0x8(%rsp),%ecx
mov    0x2cb0(%rip),%rax
mov    0x2c51(%rip),%rdx
mov    0x2d2a(%rip),%rsi
or     (%rax),%ecx
or     (%rdx),%ecx
or     (%rsi),%ecx
mov    %ecx,0x8(%rsp)
mov    0x2d41(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rsp),%rax
mov    0x2c53(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2da6(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2ca5(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2d70(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2d27(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2c72(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2d59(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2d24(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2bcb(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2c36(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2c8d(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2d04(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2bfb(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2b9e(%rip),%rdx
mov    (%rdx),%edx
mov    0x2b8d(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2d10(%rip),%rdx
mov    (%rdx),%edx
mov    0x2cc7(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2bca(%rip),%rdx
mov    (%rdx),%edx
mov    0x2b91(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2b64(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2cef(%rip),%rdx
mov    (%rdx),%edx
mov    0x2c26(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2c21(%rip),%rdx
mov    (%rdx),%edx
mov    0x2c58(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2bfb(%rip),%rdx
mov    (%rdx),%edx
mov    0x2c82(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2c9d(%rip),%rdx
mov    (%rdx),%edx
mov    0x2b9c(%rip),%rsi
mov    (%rsi),%rsi
mov    %edx,(%rax,%rsi,4)
mov    0x2c8f(%rip),%rdx
mov    (%rdx),%rdx
mov    %ecx,(%rax,%rdx,4)
mov    0x2b2a(%rip),%rax
mov    0x2c63(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2c08(%rip),%rax
or     (%rax),%ecx
mov    0x2b7f(%rip),%rax
or     (%rax),%ecx
mov    0x2c06(%rip),%rax
mov    0x2b27(%rip),%rdx
mov    (%rdx),%edx
or     (%rax),%edx
mov    0x2ba4(%rip),%rax
mov    0x2ae5(%rip),%rsi
mov    (%rsi),%esi
or     (%rax),%esi
mov    0x2baa(%rip),%rax
or     (%rax),%esi
mov    0x2c09(%rip),%rax
or     (%rax),%esi
mov    0x2b08(%rip),%rax
or     (%rax),%esi
mov    %ecx,0x18(%rsp)
mov    0x2b2b(%rip),%rax
or     (%rax),%esi
mov    %edx,0x1c(%rsp)
mov    %esi,0x20(%rsp)
mov    0x2b82(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   2080 <tcsetattr@plt>
mov    0x2ae7(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   2050 <tcflush@plt>
mov    %ebx,%edi
call   2060 <close@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
lea    0xc00(%rip),%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    2030 <initlog@plt>

LLVM IR (-O0):
%struct.termios = type { i32, i32*, i32, i32, i32 }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@.str = [20 x i8] c"can't open console!\00"
@CBAUD = global i32 0
@CBAUDEX = global i32 0
@CSIZE = global i32 0
@CSTOPB = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@HUPCL = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@CINTR = global i32 0
@VINTR = global i64 0
@CQUIT = global i32 0
@VQUIT = global i64 0
@CERASE = global i32 0
@VERASE = global i64 0
@CKILL = global i32 0
@VKILL = global i64 0
@CEOF = global i32 0
@VEOF = global i64 0
@VTIME = global i64 0
@VMIN = global i64 0
@_POSIX_VDISABLE = global i8* null
@VSWTC = global i64 0
@CSTART = global i32 0
@VSTART = global i64 0
@CSTOP = global i32 0
@VSTOP = global i64 0
@CSUSP = global i32 0
@VSUSP = global i64 0
@VEOL = global i64 0
@CREPRINT = global i32 0
@VREPRINT = global i64 0
@CDISCARD = global i32 0
@VDISCARD = global i64 0
@CWERASE = global i32 0
@VWERASE = global i64 0
@CLNEXT = global i32 0
@VLNEXT = global i64 0
@VEOL2 = global i64 0
@IGNPAR = global i32 0
@ICRNL = global i32 0
@IXON = global i32 0
@IXANY = global i32 0
@OPOST = global i32 0
@ONLCR = global i32 0
@ISIG = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOCTL = global i32 0
@ECHOPRT = global i32 0
@ECHOKE = global i32 0
@TCSANOW = global i32 0
@TCIOFLUSH = global i32 0
define void @console_stty() {
%1 = alloca %struct.termios
%2 = alloca i32
%3 = load i32, i32* @O_RDWR
%4 = load i32, i32* @O_NOCTTY
%5 = or i32 %3, %4
%6 = call i32 @console_open(i32 %5)
store i32 %6, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @initlog(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %153
10: ; preds = %0
%11 = load i32, i32* %2
%12 = call i32 @tcgetattr(i32 %11, %struct.termios* %1)
%13 = load i32, i32* @CBAUD
%14 = load i32, i32* @CBAUDEX
%15 = or i32 %13, %14
%16 = load i32, i32* @CSIZE
%17 = or i32 %15, %16
%18 = load i32, i32* @CSTOPB
%19 = or i32 %17, %18
%20 = load i32, i32* @PARENB
%21 = or i32 %19, %20
%22 = load i32, i32* @PARODD
%23 = or i32 %21, %22
%24 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%25 = load i32, i32* %24
%26 = and i32 %25, %23
store i32 %26, i32* %24
%27 = load i32, i32* @HUPCL
%28 = load i32, i32* @CLOCAL
%29 = or i32 %27, %28
%30 = load i32, i32* @CREAD
%31 = or i32 %29, %30
%32 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%33 = load i32, i32* %32
%34 = or i32 %33, %31
store i32 %34, i32* %32
%35 = load i32, i32* @CINTR
%36 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%37 = load i32*, i32** %36
%38 = load i64, i64* @VINTR
%39 = getelementptr inbounds i32, i32* %37, i64 %38
store i32 %35, i32* %39
%40 = load i32, i32* @CQUIT
%41 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%42 = load i32*, i32** %41
%43 = load i64, i64* @VQUIT
%44 = getelementptr inbounds i32, i32* %42, i64 %43
store i32 %40, i32* %44
%45 = load i32, i32* @CERASE
%46 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%47 = load i32*, i32** %46
%48 = load i64, i64* @VERASE
%49 = getelementptr inbounds i32, i32* %47, i64 %48
store i32 %45, i32* %49
%50 = load i32, i32* @CKILL
%51 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%52 = load i32*, i32** %51
%53 = load i64, i64* @VKILL
%54 = getelementptr inbounds i32, i32* %52, i64 %53
store i32 %50, i32* %54
%55 = load i32, i32* @CEOF
%56 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%57 = load i32*, i32** %56
%58 = load i64, i64* @VEOF
%59 = getelementptr inbounds i32, i32* %57, i64 %58
store i32 %55, i32* %59
%60 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%61 = load i32*, i32** %60
%62 = load i64, i64* @VTIME
%63 = getelementptr inbounds i32, i32* %61, i64 %62
store i32 0, i32* %63
%64 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%65 = load i32*, i32** %64
%66 = load i64, i64* @VMIN
%67 = getelementptr inbounds i32, i32* %65, i64 %66
store i32 1, i32* %67
%68 = load i8*, i8** @_POSIX_VDISABLE
%69 = ptrtoint i8* %68 to i32
%70 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%71 = load i32*, i32** %70
%72 = load i64, i64* @VSWTC
%73 = getelementptr inbounds i32, i32* %71, i64 %72
store i32 %69, i32* %73
%74 = load i32, i32* @CSTART
%75 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%76 = load i32*, i32** %75
%77 = load i64, i64* @VSTART
%78 = getelementptr inbounds i32, i32* %76, i64 %77
store i32 %74, i32* %78
%79 = load i32, i32* @CSTOP
%80 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%81 = load i32*, i32** %80
%82 = load i64, i64* @VSTOP
%83 = getelementptr inbounds i32, i32* %81, i64 %82
store i32 %79, i32* %83
%84 = load i32, i32* @CSUSP
%85 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%86 = load i32*, i32** %85
%87 = load i64, i64* @VSUSP
%88 = getelementptr inbounds i32, i32* %86, i64 %87
store i32 %84, i32* %88
%89 = load i8*, i8** @_POSIX_VDISABLE
%90 = ptrtoint i8* %89 to i32
%91 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%92 = load i32*, i32** %91
%93 = load i64, i64* @VEOL
%94 = getelementptr inbounds i32, i32* %92, i64 %93
store i32 %90, i32* %94
%95 = load i32, i32* @CREPRINT
%96 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%97 = load i32*, i32** %96
%98 = load i64, i64* @VREPRINT
%99 = getelementptr inbounds i32, i32* %97, i64 %98
store i32 %95, i32* %99
%100 = load i32, i32* @CDISCARD
%101 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%102 = load i32*, i32** %101
%103 = load i64, i64* @VDISCARD
%104 = getelementptr inbounds i32, i32* %102, i64 %103
store i32 %100, i32* %104
%105 = load i32, i32* @CWERASE
%106 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%107 = load i32*, i32** %106
%108 = load i64, i64* @VWERASE
%109 = getelementptr inbounds i32, i32* %107, i64 %108
store i32 %105, i32* %109
%110 = load i32, i32* @CLNEXT
%111 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%112 = load i32*, i32** %111
%113 = load i64, i64* @VLNEXT
%114 = getelementptr inbounds i32, i32* %112, i64 %113
store i32 %110, i32* %114
%115 = load i8*, i8** @_POSIX_VDISABLE
%116 = ptrtoint i8* %115 to i32
%117 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 1
%118 = load i32*, i32** %117
%119 = load i64, i64* @VEOL2
%120 = getelementptr inbounds i32, i32* %118, i64 %119
store i32 %116, i32* %120
%121 = load i32, i32* @IGNPAR
%122 = load i32, i32* @ICRNL
%123 = or i32 %121, %122
%124 = load i32, i32* @IXON
%125 = or i32 %123, %124
%126 = load i32, i32* @IXANY
%127 = or i32 %125, %126
%128 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 2
store i32 %127, i32* %128
%129 = load i32, i32* @OPOST
%130 = load i32, i32* @ONLCR
%131 = or i32 %129, %130
%132 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 3
store i32 %131, i32* %132
%133 = load i32, i32* @ISIG
%134 = load i32, i32* @ICANON
%135 = or i32 %133, %134
%136 = load i32, i32* @ECHO
%137 = or i32 %135, %136
%138 = load i32, i32* @ECHOCTL
%139 = or i32 %137, %138
%140 = load i32, i32* @ECHOPRT
%141 = or i32 %139, %140
%142 = load i32, i32* @ECHOKE
%143 = or i32 %141, %142
%144 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 4
store i32 %143, i32* %144
%145 = load i32, i32* %2
%146 = load i32, i32* @TCSANOW
%147 = call i32 @tcsetattr(i32 %145, i32 %146, %struct.termios* %1)
%148 = load i32, i32* %2
%149 = load i32, i32* @TCIOFLUSH
%150 = call i32 @tcflush(i32 %148, i32 %149)
%151 = load i32, i32* %2
%152 = call i32 @close(i32 %151)
br label %153
153: ; preds = %10, %8
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32, i32*, i32, i32, i32 }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@.str = [20 x i8] c"can't open console!\00"
@CBAUD = global i32 0
@CBAUDEX = global i32 0
@CSIZE = global i32 0
@CSTOPB = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@HUPCL = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@CINTR = global i32 0
@VINTR = global i64 0
@CQUIT = global i32 0
@VQUIT = global i64 0
@CERASE = global i32 0
@VERASE = global i64 0
@CKILL = global i32 0
@VKILL = global i64 0
@CEOF = global i32 0
@VEOF = global i64 0
@VTIME = global i64 0
@VMIN = global i64 0
@_POSIX_VDISABLE = global i8* null
@VSWTC = global i64 0
@CSTART = global i32 0
@VSTART = global i64 0
@CSTOP = global i32 0
@VSTOP = global i64 0
@CSUSP = global i32 0
@VSUSP = global i64 0
@VEOL = global i64 0
@CREPRINT = global i32 0
@VREPRINT = global i64 0
@CDISCARD = global i32 0
@VDISCARD = global i64 0
@CWERASE = global i32 0
@VWERASE = global i64 0
@CLNEXT = global i32 0
@VLNEXT = global i64 0
@VEOL2 = global i64 0
@IGNPAR = global i32 0
@ICRNL = global i32 0
@IXON = global i32 0
@IXANY = global i32 0
@OPOST = global i32 0
@ONLCR = global i32 0
@ISIG = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOCTL = global i32 0
@ECHOPRT = global i32 0
@ECHOKE = global i32 0
@TCSANOW = global i32 0
@TCIOFLUSH = global i32 0
define void @console_stty() {
%1 = alloca %struct.termios
%2 = bitcast %struct.termios* %1 to i8*
%3 = load i32, i32* @O_RDWR
%4 = load i32, i32* @O_NOCTTY
%5 = or i32 %4, %3
%6 = tail call i32 @console_open(i32 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = tail call i32 @initlog(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %112
10: ; preds = %0
%11 = call i32 @tcgetattr(i32 %6, %struct.termios* %1)
%12 = load i32, i32* @CBAUD
%13 = load i32, i32* @CBAUDEX
%14 = or i32 %13, %12
%15 = load i32, i32* @CSIZE
%16 = or i32 %14, %15
%17 = load i32, i32* @CSTOPB
%18 = or i32 %16, %17
%19 = load i32, i32* @PARENB
%20 = or i32 %18, %19
%21 = load i32, i32* @PARODD
%22 = or i32 %20, %21
%23 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%24 = load i32, i32* %23
%25 = and i32 %24, %22
%26 = load i32, i32* @HUPCL
%27 = load i32, i32* @CLOCAL
%28 = load i32, i32* @CREAD
%29 = or i32 %26, %25
%30 = or i32 %29, %27
%31 = or i32 %30, %28
store i32 %31, i32* %23
%32 = load i32, i32* @CINTR
%33 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%34 = load i32*, i32** %33
%35 = load i64, i64* @VINTR
%36 = getelementptr inbounds i32, i32* %34, i64 %35
store i32 %32, i32* %36
%37 = load i32, i32* @CQUIT
%38 = load i64, i64* @VQUIT
%39 = getelementptr inbounds i32, i32* %34, i64 %38
store i32 %37, i32* %39
%40 = load i32, i32* @CERASE
%41 = load i64, i64* @VERASE
%42 = getelementptr inbounds i32, i32* %34, i64 %41
store i32 %40, i32* %42
%43 = load i32, i32* @CKILL
%44 = load i64, i64* @VKILL
%45 = getelementptr inbounds i32, i32* %34, i64 %44
store i32 %43, i32* %45
%46 = load i32, i32* @CEOF
%47 = load i64, i64* @VEOF
%48 = getelementptr inbounds i32, i32* %34, i64 %47
store i32 %46, i32* %48
%49 = load i64, i64* @VTIME
%50 = getelementptr inbounds i32, i32* %34, i64 %49
store i32 0, i32* %50
%51 = load i64, i64* @VMIN
%52 = getelementptr inbounds i32, i32* %34, i64 %51
store i32 1, i32* %52
%53 = load i8*, i8** @_POSIX_VDISABLE
%54 = ptrtoint i8* %53 to i64
%55 = trunc i64 %54 to i32
%56 = load i64, i64* @VSWTC
%57 = getelementptr inbounds i32, i32* %34, i64 %56
store i32 %55, i32* %57
%58 = load i32, i32* @CSTART
%59 = load i64, i64* @VSTART
%60 = getelementptr inbounds i32, i32* %34, i64 %59
store i32 %58, i32* %60
%61 = load i32, i32* @CSTOP
%62 = load i64, i64* @VSTOP
%63 = getelementptr inbounds i32, i32* %34, i64 %62
store i32 %61, i32* %63
%64 = load i32, i32* @CSUSP
%65 = load i64, i64* @VSUSP
%66 = getelementptr inbounds i32, i32* %34, i64 %65
store i32 %64, i32* %66
%67 = load i64, i64* @VEOL
%68 = getelementptr inbounds i32, i32* %34, i64 %67
store i32 %55, i32* %68
%69 = load i32, i32* @CREPRINT
%70 = load i64, i64* @VREPRINT
%71 = getelementptr inbounds i32, i32* %34, i64 %70
store i32 %69, i32* %71
%72 = load i32, i32* @CDISCARD
%73 = load i64, i64* @VDISCARD
%74 = getelementptr inbounds i32, i32* %34, i64 %73
store i32 %72, i32* %74
%75 = load i32, i32* @CWERASE
%76 = load i64, i64* @VWERASE
%77 = getelementptr inbounds i32, i32* %34, i64 %76
store i32 %75, i32* %77
%78 = load i32, i32* @CLNEXT
%79 = load i64, i64* @VLNEXT
%80 = getelementptr inbounds i32, i32* %34, i64 %79
store i32 %78, i32* %80
%81 = load i64, i64* @VEOL2
%82 = getelementptr inbounds i32, i32* %34, i64 %81
store i32 %55, i32* %82
%83 = load i32, i32* @IGNPAR
%84 = load i32, i32* @ICRNL
%85 = or i32 %84, %83
%86 = load i32, i32* @IXON
%87 = or i32 %85, %86
%88 = load i32, i32* @IXANY
%89 = or i32 %87, %88
%90 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 2
store i32 %89, i32* %90
%91 = load i32, i32* @OPOST
%92 = load i32, i32* @ONLCR
%93 = or i32 %92, %91
%94 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 3
store i32 %93, i32* %94
%95 = load i32, i32* @ISIG
%96 = load i32, i32* @ICANON
%97 = or i32 %96, %95
%98 = load i32, i32* @ECHO
%99 = or i32 %97, %98
%100 = load i32, i32* @ECHOCTL
%101 = or i32 %99, %100
%102 = load i32, i32* @ECHOPRT
%103 = or i32 %101, %102
%104 = load i32, i32* @ECHOKE
%105 = or i32 %103, %104
%106 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 4
store i32 %105, i32* %106
%107 = load i32, i32* @TCSANOW
%108 = call i32 @tcsetattr(i32 %6, i32 %107, %struct.termios* %1)
%109 = load i32, i32* @TCIOFLUSH
%110 = call i32 @tcflush(i32 %6, i32 %109)
%111 = call i32 @close(i32 %6)
br label %112
112: ; preds = %10, %8
ret void
}