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

/* Variables and functions */
int B9600;
int CLOCAL;
int CREAD;
int CS8;
int IGNBRK;
int IGNPAR;
size_t VMIN;
size_t VTIME;
int tty_configure(struct termios *tios) {
  tios->c_cflag = CS8 | CREAD | B9600 | CLOCAL;
  tios->c_iflag = IGNBRK | IGNPAR;
  tios->c_oflag = 0;
  tios->c_lflag = 0;
  tios->c_cc[VMIN] = 1;
  tios->c_cc[VTIME] = 0;
  return (0);
}


x86 assembly (clang, -O0):
<tty_configure>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
or     (%rax),%ecx
mov    0x2ec7(%rip),%rax
or     (%rax),%ecx
mov    0x2e76(%rip),%rax
or     (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e87(%rip),%rax
mov    (%rax),%ecx
mov    0x2e6e(%rip),%rax
or     (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2e5e(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2e2d(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tty_configure>:
mov    0x2ed1(%rip),%rax
mov    0x2ed2(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2ecf(%rip),%rax
or     (%rax),%ecx
mov    0x2e7e(%rip),%rax
or     (%rax),%ecx
mov    %ecx,(%rdi)
mov    0x2e93(%rip),%rax
mov    0x2e7c(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x4(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rdi)
mov    0x8(%rdi),%rax
mov    0x2e83(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2e5a(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@CS8 = global i32 0
@CREAD = global i32 0
@B9600 = global i32 0
@CLOCAL = global i32 0
@IGNBRK = global i32 0
@IGNPAR = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
define i32 @tty_configure(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load i32, i32* @CS8
%4 = load i32, i32* @CREAD
%5 = or i32 %3, %4
%6 = load i32, i32* @B9600
%7 = or i32 %5, %6
%8 = load i32, i32* @CLOCAL
%9 = or i32 %7, %8
%10 = load %struct.termios*, %struct.termios** %2
%11 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
store i32 %9, i32* %11
%12 = load i32, i32* @IGNBRK
%13 = load i32, i32* @IGNPAR
%14 = or i32 %12, %13
%15 = load %struct.termios*, %struct.termios** %2
%16 = getelementptr inbounds %struct.termios, %struct.termios* %15, i32 0, i32 1
store i32 %14, i32* %16
%17 = load %struct.termios*, %struct.termios** %2
%18 = getelementptr inbounds %struct.termios, %struct.termios* %17, i32 0, i32 4
store i64 0, i64* %18
%19 = load %struct.termios*, %struct.termios** %2
%20 = getelementptr inbounds %struct.termios, %struct.termios* %19, i32 0, i32 3
store i64 0, i64* %20
%21 = load %struct.termios*, %struct.termios** %2
%22 = getelementptr inbounds %struct.termios, %struct.termios* %21, i32 0, i32 2
%23 = load i32*, i32** %22
%24 = load i64, i64* @VMIN
%25 = getelementptr inbounds i32, i32* %23, i64 %24
store i32 1, i32* %25
%26 = load %struct.termios*, %struct.termios** %2
%27 = getelementptr inbounds %struct.termios, %struct.termios* %26, i32 0, i32 2
%28 = load i32*, i32** %27
%29 = load i64, i64* @VTIME
%30 = getelementptr inbounds i32, i32* %28, i64 %29
store i32 0, i32* %30
ret i32 0
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@CS8 = global i32 0
@CREAD = global i32 0
@B9600 = global i32 0
@CLOCAL = global i32 0
@IGNBRK = global i32 0
@IGNPAR = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
define i32 @tty_configure(%struct.termios* nocapture %0) {
%2 = load i32, i32* @CS8
%3 = load i32, i32* @CREAD
%4 = or i32 %3, %2
%5 = load i32, i32* @B9600
%6 = or i32 %4, %5
%7 = load i32, i32* @CLOCAL
%8 = or i32 %6, %7
%9 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
store i32 %8, i32* %9
%10 = load i32, i32* @IGNBRK
%11 = load i32, i32* @IGNPAR
%12 = or i32 %11, %10
%13 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
store i32 %12, i32* %13
%14 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 3
%15 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 2
%16 = bitcast i64* %14 to i8*
%17 = load i32*, i32** %15
%18 = load i64, i64* @VMIN
%19 = getelementptr inbounds i32, i32* %17, i64 %18
store i32 1, i32* %19
%20 = load i64, i64* @VTIME
%21 = getelementptr inbounds i32, i32* %17, i64 %20
store i32 0, i32* %21
ret i32 0
}