#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 cfsetispeed(struct termios *, int /*<<< orphan*/);
int cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int tcgetattr(int, struct termios *);
int tcsetattr(int, int /*<<< orphan*/, struct termios *);
void HangUpLine(int tty) {
  int result;
  struct termios tty_data, oldtty_data;
  result = tcgetattr(tty, &oldtty_data);
  result = tcgetattr(tty, &tty_data);
  result = cfsetispeed(&tty_data, B0);
  result = cfsetospeed(&tty_data, B0);
  result = tcsetattr(tty, TCSANOW, &tty_data);
  sleep(5);
  tcsetattr(tty, TCSANOW, &oldtty_data);
}


x86 assembly (clang, -O0):
<HangUpLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1040 <tcgetattr@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <tcgetattr@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdi
call   1060 <cfsetispeed@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e3b(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdx
call   1050 <tcsetattr@plt>
mov    %eax,-0x8(%rbp)
mov    $0x5,%edi
call   1070 <sleep@plt>
mov    -0x4(%rbp),%edi
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   1050 <tcsetattr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HangUpLine>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1040 <tcgetattr@plt>
lea    0x10(%rsp),%r15
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <tcgetattr@plt>
mov    0x2e58(%rip),%r12
mov    (%r12),%esi
mov    %r15,%rdi
call   1060 <cfsetispeed@plt>
mov    (%r12),%esi
mov    %r15,%rdi
call   1030 <cfsetospeed@plt>
mov    0x2e49(%rip),%r12
mov    (%r12),%esi
mov    %ebx,%edi
mov    %r15,%rdx
call   1050 <tcsetattr@plt>
mov    $0x5,%edi
call   1070 <sleep@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 @HangUpLine(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.termios
%5 = alloca %struct.termios
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @tcgetattr(i32 %6, %struct.termios* %5)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = call i32 @tcgetattr(i32 %8, %struct.termios* %4)
store i32 %9, i32* %3
%10 = load i32, i32* @B0
%11 = call i32 @cfsetispeed(%struct.termios* %4, i32 %10)
store i32 %11, i32* %3
%12 = load i32, i32* @B0
%13 = call i32 @cfsetospeed(%struct.termios* %4, i32 %12)
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = load i32, i32* @TCSANOW
%16 = call i32 @tcsetattr(i32 %14, i32 %15, %struct.termios* %4)
store i32 %16, i32* %3
%17 = call i32 @sleep(i32 5)
%18 = load i32, i32* %2
%19 = load i32, i32* @TCSANOW
%20 = call i32 @tcsetattr(i32 %18, i32 %19, %struct.termios* %5)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@B0 = global i32 0
@TCSANOW = global i32 0
define void @HangUpLine(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* %3)
%7 = call i32 @tcgetattr(i32 %0, %struct.termios* %2)
%8 = load i32, i32* @B0
%9 = call i32 @cfsetispeed(%struct.termios* %2, i32 %8)
%10 = load i32, i32* @B0
%11 = call i32 @cfsetospeed(%struct.termios* %2, i32 %10)
%12 = load i32, i32* @TCSANOW
%13 = call i32 @tcsetattr(i32 %0, i32 %12, %struct.termios* %2)
%14 = call i32 @sleep(i32 5)
%15 = load i32, i32* @TCSANOW
%16 = call i32 @tcsetattr(i32 %0, i32 %15, %struct.termios* %3)
ret void
}