#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 dummy;
};

/* Variables and functions */
int /*<<< orphan*/ B0;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ cfsetispeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ usleep(int);
void Init_Port(int fd) {
  struct termios tty, old;
  tcgetattr(fd, &tty);
  tcgetattr(fd, &old);
  cfsetospeed(&tty, B0);
  cfsetispeed(&tty, B0);
  tcsetattr(fd, TCSANOW, &tty);
  usleep(20000);
  tcsetattr(fd, TCSANOW, &old);
}


x86 assembly (clang, -O0):
<Init_Port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1040 <tcgetattr@plt>
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <tcgetattr@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1060 <cfsetispeed@plt>
mov    -0x4(%rbp),%edi
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1050 <tcsetattr@plt>
mov    $0x4e20,%edi
call   1070 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    0x2e28(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdx
call   1050 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Init_Port>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x10(%rsp),%r15
mov    %r15,%rsi
call   1040 <tcgetattr@plt>
lea    0x8(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <tcgetattr@plt>
mov    0x2e58(%rip),%r12
mov    (%r12),%esi
mov    %r15,%rdi
call   1030 <cfsetospeed@plt>
mov    (%r12),%esi
mov    %r15,%rdi
call   1060 <cfsetispeed@plt>
mov    0x2e49(%rip),%r12
mov    (%r12),%esi
mov    %ebx,%edi
mov    %r15,%rdx
call   1050 <tcsetattr@plt>
mov    $0x4e20,%edi
call   1070 <usleep@plt>
mov    (%r12),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   1050 <tcsetattr@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@B0 = global i32 0
@TCSANOW = global i32 0
define void @Init_Port(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.termios
%4 = alloca %struct.termios
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @tcgetattr(i32 %5, %struct.termios* %3)
%7 = load i32, i32* %2
%8 = call i32 @tcgetattr(i32 %7, %struct.termios* %4)
%9 = load i32, i32* @B0
%10 = call i32 @cfsetospeed(%struct.termios* %3, i32 %9)
%11 = load i32, i32* @B0
%12 = call i32 @cfsetispeed(%struct.termios* %3, i32 %11)
%13 = load i32, i32* %2
%14 = load i32, i32* @TCSANOW
%15 = call i32 @tcsetattr(i32 %13, i32 %14, %struct.termios* %3)
%16 = call i32 @usleep(i32 20000)
%17 = load i32, i32* %2
%18 = load i32, i32* @TCSANOW
%19 = call i32 @tcsetattr(i32 %17, i32 %18, %struct.termios* %4)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@B0 = global i32 0
@TCSANOW = global i32 0
define void @Init_Port(i32 %0) {
%2 = alloca %struct.termios
%3 = alloca %struct.termios
%4 = bitcast %struct.termios* %2 to i8*
%5 = bitcast %struct.termios* %3 to i8*
%6 = call i32 @tcgetattr(i32 %0, %struct.termios* %2)
%7 = call i32 @tcgetattr(i32 %0, %struct.termios* %3)
%8 = load i32, i32* @B0
%9 = call i32 @cfsetospeed(%struct.termios* %2, i32 %8)
%10 = load i32, i32* @B0
%11 = call i32 @cfsetispeed(%struct.termios* %2, i32 %10)
%12 = load i32, i32* @TCSANOW
%13 = call i32 @tcsetattr(i32 %0, i32 %12, %struct.termios* %2)
%14 = call i32 @usleep(i32 20000)
%15 = load i32, i32* @TCSANOW
%16 = call i32 @tcsetattr(i32 %0, i32 %15, %struct.termios* %3)
ret void
}