#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_cc;
  int /*<<< orphan*/ c_lflag;
};

/* Variables and functions */
int /*<<< orphan*/ ECHO;
int /*<<< orphan*/ ICANON;
int /*<<< orphan*/ ISIG;
size_t VMIN;
size_t VTIME;
struct termios *termios_init(struct termios *init_term) {
  struct termios *term = init_term;
  term->c_lflag &= ~ICANON;
  term->c_lflag &= ~ECHO;
  term->c_lflag &= ~ISIG;
  term->c_cc[VMIN] = 1;
  term->c_cc[VTIME] = 0;
  return term;
}


x86 assembly (clang, -O0):
<termios_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x10(%rbp),%rax
and    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    0x2ebb(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x10(%rbp),%rax
and    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    0x2e9d(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x10(%rbp),%rax
and    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e78(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e50(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<termios_init>:
mov    0x2eb9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ed8(%rip),%rax
or     (%rax),%ecx
mov    %rdi,%rax
mov    0x2ec4(%rip),%rdx
or     (%rdx),%ecx
not    %ecx
and    %ecx,0x8(%rdi)
mov    (%rdi),%rcx
mov    0x2eab(%rip),%rdx
mov    (%rdx),%rdx
movl   $0x1,(%rcx,%rdx,4)
mov    0x2e8a(%rip),%rdx
mov    (%rdx),%rdx
movl   $0x0,(%rcx,%rdx,4)
ret

LLVM IR (-O0):
%struct.termios = type { i32*, i32 }
@ICANON = global i32 0
@ECHO = global i32 0
@ISIG = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
define %struct.termios* @termios_init(%struct.termios* %0) {
%2 = alloca %struct.termios*
%3 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%4 = load %struct.termios*, %struct.termios** %2
store %struct.termios* %4, %struct.termios** %3
%5 = load i32, i32* @ICANON
%6 = xor i32 %5, -1
%7 = load %struct.termios*, %struct.termios** %3
%8 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = and i32 %9, %6
store i32 %10, i32* %8
%11 = load i32, i32* @ECHO
%12 = xor i32 %11, -1
%13 = load %struct.termios*, %struct.termios** %3
%14 = getelementptr inbounds %struct.termios, %struct.termios* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = and i32 %15, %12
store i32 %16, i32* %14
%17 = load i32, i32* @ISIG
%18 = xor i32 %17, -1
%19 = load %struct.termios*, %struct.termios** %3
%20 = getelementptr inbounds %struct.termios, %struct.termios* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = and i32 %21, %18
store i32 %22, i32* %20
%23 = load %struct.termios*, %struct.termios** %3
%24 = getelementptr inbounds %struct.termios, %struct.termios* %23, i32 0, i32 0
%25 = load i32*, i32** %24
%26 = load i64, i64* @VMIN
%27 = getelementptr inbounds i32, i32* %25, i64 %26
store i32 1, i32* %27
%28 = load %struct.termios*, %struct.termios** %3
%29 = getelementptr inbounds %struct.termios, %struct.termios* %28, i32 0, i32 0
%30 = load i32*, i32** %29
%31 = load i64, i64* @VTIME
%32 = getelementptr inbounds i32, i32* %30, i64 %31
store i32 0, i32* %32
%33 = load %struct.termios*, %struct.termios** %3
ret %struct.termios* %33
}

LLVM IR (-O2):
%struct.termios = type { i32*, i32 }
@ICANON = global i32 0
@ECHO = global i32 0
@ISIG = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
define %struct.termios* @termios_init(%struct.termios* returned %0) {
%2 = load i32, i32* @ICANON
%3 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
%4 = load i32, i32* %3
%5 = load i32, i32* @ECHO
%6 = or i32 %2, %5
%7 = load i32, i32* @ISIG
%8 = or i32 %6, %7
%9 = xor i32 %8, -1
%10 = and i32 %4, %9
store i32 %10, i32* %3
%11 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%12 = load i32*, i32** %11
%13 = load i64, i64* @VMIN
%14 = getelementptr inbounds i32, i32* %12, i64 %13
store i32 1, i32* %14
%15 = load i64, i64* @VTIME
%16 = getelementptr inbounds i32, i32* %12, i64 %15
store i32 0, i32* %16
ret %struct.termios* %0
}