#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
unsigned int receiveByte(int);
void *receiveWord(int);
int /*<<< orphan*/ sendByte(int, unsigned int);
int /*<<< orphan*/ sendString(int, int, char *);
int /*<<< orphan*/ sendWord(int, int /*<<< orphan*/);
void tube_File(unsigned int *reg) {
  if (0) {
    printf("%08x %08x %08x %08x %08x %08x\r\n", reg[0], reg[1], reg[2], reg[3],
           reg[4], reg[5]);
    printf("%s\r\n", (char *)reg[1]);
  }
  unsigned int *ptr = reg + 5;
  sendByte(2, 0x14);
  sendWord(2, *ptr--);
  sendWord(2, *ptr--);
  sendWord(2, *ptr--);
  sendWord(2, *ptr--);
  sendString(2, 0x0D, (char *)*ptr--);
  sendByte(2, *ptr);
  *ptr = receiveByte(2);
  ptr = reg + 5;
  *ptr-- = receiveWord(2);
  *ptr-- = receiveWord(2);
  *ptr-- = receiveWord(2);
  *ptr-- = receiveWord(2);
  if (0) {
    printf("%08x %08x %08x %08x %08x %08x\r\n", reg[0], reg[1], reg[2], reg[3],
           reg[4], reg[5]);
  }
}


x86 assembly (clang, -O0):
<tube_File>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x10(%rbp)
mov    $0x2,%edi
mov    $0x14,%esi
call   1070 <sendByte@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%eax
mov    %eax,%edx
mov    $0x2,%edi
mov    $0xd,%esi
call   1030 <sendString@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    $0x2,%edi
call   1070 <sendByte@plt>
mov    $0x2,%edi
call   1060 <receiveByte@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x10(%rbp)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x10(%rbp)
mov    %ecx,(%rax)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x10(%rbp)
mov    %ecx,(%rax)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x10(%rbp)
mov    %ecx,(%rax)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x10(%rbp)
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tube_File>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%edi
mov    $0x14,%esi
call   1070 <sendByte@plt>
mov    0x14(%rbx),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    0x10(%rbx),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    0xc(%rbx),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    0x8(%rbx),%esi
mov    $0x2,%edi
call   1050 <sendWord@plt>
mov    0x4(%rbx),%edx
mov    $0x2,%edi
mov    $0xd,%esi
call   1030 <sendString@plt>
mov    (%rbx),%esi
mov    $0x2,%edi
call   1070 <sendByte@plt>
mov    $0x2,%edi
call   1060 <receiveByte@plt>
mov    %eax,(%rbx)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,0x14(%rbx)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,0x10(%rbx)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,0xc(%rbx)
mov    $0x2,%edi
call   1040 <receiveWord@plt>
mov    %eax,0x8(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @tube_File(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 5
store i32* %5, i32** %3
%6 = call i32 @sendByte(i32 2, i32 20)
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i32 -1
store i32* %8, i32** %3
%9 = load i32, i32* %7
%10 = call i32 @sendWord(i32 2, i32 %9)
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i32 -1
store i32* %12, i32** %3
%13 = load i32, i32* %11
%14 = call i32 @sendWord(i32 2, i32 %13)
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i32 -1
store i32* %16, i32** %3
%17 = load i32, i32* %15
%18 = call i32 @sendWord(i32 2, i32 %17)
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i32 -1
store i32* %20, i32** %3
%21 = load i32, i32* %19
%22 = call i32 @sendWord(i32 2, i32 %21)
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i32 -1
store i32* %24, i32** %3
%25 = load i32, i32* %23
%26 = zext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
%28 = call i32 @sendString(i32 2, i32 13, i8* %27)
%29 = load i32*, i32** %3
%30 = load i32, i32* %29
%31 = call i32 @sendByte(i32 2, i32 %30)
%32 = call i32 @receiveByte(i32 2)
%33 = load i32*, i32** %3
store i32 %32, i32* %33
%34 = load i32*, i32** %2
%35 = getelementptr inbounds i32, i32* %34, i64 5
store i32* %35, i32** %3
%36 = call i8* @receiveWord(i32 2)
%37 = ptrtoint i8* %36 to i32
%38 = load i32*, i32** %3
%39 = getelementptr inbounds i32, i32* %38, i32 -1
store i32* %39, i32** %3
store i32 %37, i32* %38
%40 = call i8* @receiveWord(i32 2)
%41 = ptrtoint i8* %40 to i32
%42 = load i32*, i32** %3
%43 = getelementptr inbounds i32, i32* %42, i32 -1
store i32* %43, i32** %3
store i32 %41, i32* %42
%44 = call i8* @receiveWord(i32 2)
%45 = ptrtoint i8* %44 to i32
%46 = load i32*, i32** %3
%47 = getelementptr inbounds i32, i32* %46, i32 -1
store i32* %47, i32** %3
store i32 %45, i32* %46
%48 = call i8* @receiveWord(i32 2)
%49 = ptrtoint i8* %48 to i32
%50 = load i32*, i32** %3
%51 = getelementptr inbounds i32, i32* %50, i32 -1
store i32* %51, i32** %3
store i32 %49, i32* %50
ret void
}

LLVM IR (-O2):
define void @tube_File(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 5
%3 = tail call i32 @sendByte(i32 2, i32 20)
%4 = getelementptr inbounds i32, i32* %0, i64 4
%5 = load i32, i32* %2
%6 = tail call i32 @sendWord(i32 2, i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 3
%8 = load i32, i32* %4
%9 = tail call i32 @sendWord(i32 2, i32 %8)
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %7
%12 = tail call i32 @sendWord(i32 2, i32 %11)
%13 = getelementptr inbounds i32, i32* %0, i64 1
%14 = load i32, i32* %10
%15 = tail call i32 @sendWord(i32 2, i32 %14)
%16 = load i32, i32* %13
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
%19 = tail call i32 @sendString(i32 2, i32 13, i8* %18)
%20 = load i32, i32* %0
%21 = tail call i32 @sendByte(i32 2, i32 %20)
%22 = tail call i32 @receiveByte(i32 2)
store i32 %22, i32* %0
%23 = tail call i8* @receiveWord(i32 2)
%24 = ptrtoint i8* %23 to i64
%25 = trunc i64 %24 to i32
store i32 %25, i32* %2
%26 = tail call i8* @receiveWord(i32 2)
%27 = ptrtoint i8* %26 to i64
%28 = trunc i64 %27 to i32
store i32 %28, i32* %4
%29 = tail call i8* @receiveWord(i32 2)
%30 = ptrtoint i8* %29 to i64
%31 = trunc i64 %30 to i32
store i32 %31, i32* %7
%32 = tail call i8* @receiveWord(i32 2)
%33 = ptrtoint i8* %32 to i64
%34 = trunc i64 %33 to i32
store i32 %34, i32* %10
ret void
}