#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 */
typedef int /*<<< orphan*/ tio;
struct termios {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ B115200;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ cfsetispeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct termios *, int /*<<< orphan*/, int);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
void _set_tio(int fd) {
  struct termios tio;
  memset(&tio, 0, sizeof(tio));
  tcgetattr(fd, &tio);
  cfsetospeed(&tio, B115200);
  cfsetispeed(&tio, B115200);
  tcsetattr(fd, TCSANOW, &tio);
}


x86 assembly (clang, -O0):
<_set_tio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1050 <tcgetattr@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1070 <cfsetispeed@plt>
mov    -0x4(%rbp),%edi
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1060 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_tio>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <tcgetattr@plt>
mov    0x2e58(%rip),%r15
mov    (%r15),%esi
mov    %r14,%rdi
call   1030 <cfsetospeed@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1070 <cfsetispeed@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   1060 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@B115200 = global i32 0
@TCSANOW = global i32 0
define void @_set_tio(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.termios
store i32 %0, i32* %2
%4 = call i32 @memset(%struct.termios* %3, i32 0, i32 4)
%5 = load i32, i32* %2
%6 = call i32 @tcgetattr(i32 %5, %struct.termios* %3)
%7 = load i32, i32* @B115200
%8 = call i32 @cfsetospeed(%struct.termios* %3, i32 %7)
%9 = load i32, i32* @B115200
%10 = call i32 @cfsetispeed(%struct.termios* %3, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* @TCSANOW
%13 = call i32 @tcsetattr(i32 %11, i32 %12, %struct.termios* %3)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@B115200 = global i32 0
@TCSANOW = global i32 0
define void @_set_tio(i32 %0) {
%2 = alloca %struct.termios
%3 = bitcast %struct.termios* %2 to i8*
%4 = call i32 @memset(%struct.termios* %2, i32 0, i32 4)
%5 = call i32 @tcgetattr(i32 %0, %struct.termios* %2)
%6 = load i32, i32* @B115200
%7 = call i32 @cfsetospeed(%struct.termios* %2, i32 %6)
%8 = load i32, i32* @B115200
%9 = call i32 @cfsetispeed(%struct.termios* %2, i32 %8)
%10 = load i32, i32* @TCSANOW
%11 = call i32 @tcsetattr(i32 %0, i32 %10, %struct.termios* %2)
ret void
}