#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 */
unsigned char *get_address();
int /*<<< orphan*/ send(char);
int /*<<< orphan*/ send_hex(unsigned char, int);
void command_read(void) {
  unsigned char *address = get_address();
  send_hex((unsigned)address, 8);
  char sep = ':';
  for (int i = 0; i != 16; ++i) {
    send(sep);
    send_hex(address[i], 2);
    sep = ' ';
  }
}


x86 assembly (clang, -O0):
<command_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_address@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x8,%esi
movzbl %al,%edi
call   1050 <send_hex@plt>
movb   $0x3a,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
je     119a <command_read+0x6a>
movsbl -0x9(%rbp),%edi
call   1040 <send@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    $0x2,%esi
movzbl (%rax,%rcx,1),%edi
call   1050 <send_hex@plt>
movb   $0x20,-0x9(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115f <command_read+0x2f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_read>:
push   %rbx
xor    %eax,%eax
call   1030 <get_address@plt>
mov    %rax,%rbx
movzbl %bl,%edi
mov    $0x8,%esi
call   1050 <send_hex@plt>
mov    $0x3a,%edi
call   1040 <send@plt>
movzbl (%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x1(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x2(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x3(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x4(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x5(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x6(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x7(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x8(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0x9(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0xa(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0xb(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0xc(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0xd(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0xe(%rbx),%edi
mov    $0x2,%esi
call   1050 <send_hex@plt>
mov    $0x20,%edi
call   1040 <send@plt>
movzbl 0xf(%rbx),%edi
mov    $0x2,%esi
pop    %rbx
jmp    1050 <send_hex@plt>

LLVM IR (-O0):
define void @command_read() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca i32
%4 = call i8* (...) @get_address()
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = ptrtoint i8* %5 to i32
%7 = trunc i32 %6 to i8
%8 = call i32 @send_hex(i8 zeroext %7, i32 8)
store i8 58, i8* %2
store i32 0, i32* %3
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 16
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i8, i8* %2
%14 = call i32 @send(i8 signext %13)
%15 = load i8*, i8** %1
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @send_hex(i8 zeroext %19, i32 2)
store i8 32, i8* %2
br label %21
21: ; preds = %12
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @command_read() {
%1 = tail call i8* (...) @get_address()
%2 = ptrtoint i8* %1 to i64
%3 = trunc i64 %2 to i8
%4 = tail call i32 @send_hex(i8 zeroext %3, i32 8)
%5 = tail call i32 @send(i8 signext 58)
%6 = load i8, i8* %1
%7 = tail call i32 @send_hex(i8 zeroext %6, i32 2)
%8 = tail call i32 @send(i8 signext 32)
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = tail call i32 @send_hex(i8 zeroext %10, i32 2)
%12 = tail call i32 @send(i8 signext 32)
%13 = getelementptr inbounds i8, i8* %1, i64 2
%14 = load i8, i8* %13
%15 = tail call i32 @send_hex(i8 zeroext %14, i32 2)
%16 = tail call i32 @send(i8 signext 32)
%17 = getelementptr inbounds i8, i8* %1, i64 3
%18 = load i8, i8* %17
%19 = tail call i32 @send_hex(i8 zeroext %18, i32 2)
%20 = tail call i32 @send(i8 signext 32)
%21 = getelementptr inbounds i8, i8* %1, i64 4
%22 = load i8, i8* %21
%23 = tail call i32 @send_hex(i8 zeroext %22, i32 2)
%24 = tail call i32 @send(i8 signext 32)
%25 = getelementptr inbounds i8, i8* %1, i64 5
%26 = load i8, i8* %25
%27 = tail call i32 @send_hex(i8 zeroext %26, i32 2)
%28 = tail call i32 @send(i8 signext 32)
%29 = getelementptr inbounds i8, i8* %1, i64 6
%30 = load i8, i8* %29
%31 = tail call i32 @send_hex(i8 zeroext %30, i32 2)
%32 = tail call i32 @send(i8 signext 32)
%33 = getelementptr inbounds i8, i8* %1, i64 7
%34 = load i8, i8* %33
%35 = tail call i32 @send_hex(i8 zeroext %34, i32 2)
%36 = tail call i32 @send(i8 signext 32)
%37 = getelementptr inbounds i8, i8* %1, i64 8
%38 = load i8, i8* %37
%39 = tail call i32 @send_hex(i8 zeroext %38, i32 2)
%40 = tail call i32 @send(i8 signext 32)
%41 = getelementptr inbounds i8, i8* %1, i64 9
%42 = load i8, i8* %41
%43 = tail call i32 @send_hex(i8 zeroext %42, i32 2)
%44 = tail call i32 @send(i8 signext 32)
%45 = getelementptr inbounds i8, i8* %1, i64 10
%46 = load i8, i8* %45
%47 = tail call i32 @send_hex(i8 zeroext %46, i32 2)
%48 = tail call i32 @send(i8 signext 32)
%49 = getelementptr inbounds i8, i8* %1, i64 11
%50 = load i8, i8* %49
%51 = tail call i32 @send_hex(i8 zeroext %50, i32 2)
%52 = tail call i32 @send(i8 signext 32)
%53 = getelementptr inbounds i8, i8* %1, i64 12
%54 = load i8, i8* %53
%55 = tail call i32 @send_hex(i8 zeroext %54, i32 2)
%56 = tail call i32 @send(i8 signext 32)
%57 = getelementptr inbounds i8, i8* %1, i64 13
%58 = load i8, i8* %57
%59 = tail call i32 @send_hex(i8 zeroext %58, i32 2)
%60 = tail call i32 @send(i8 signext 32)
%61 = getelementptr inbounds i8, i8* %1, i64 14
%62 = load i8, i8* %61
%63 = tail call i32 @send_hex(i8 zeroext %62, i32 2)
%64 = tail call i32 @send(i8 signext 32)
%65 = getelementptr inbounds i8, i8* %1, i64 15
%66 = load i8, i8* %65
%67 = tail call i32 @send_hex(i8 zeroext %66, i32 2)
ret void
}