#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*/ hex(char const);
int /*<<< orphan*/ ip(char const *);
int /*<<< orphan*/ line();
int /*<<< orphan*/ logtype(char const *);
int /*<<< orphan*/ name(char const *);
int /*<<< orphan*/ number(unsigned int);
int /*<<< orphan*/ space();
int /*<<< orphan*/ string(char *);
void log_rr(const char server[4], const char *q, const char type[2],
            const char *buf, unsigned int len, unsigned int ttl) {
  int i = 0;
  string("     rr ");
  ip(server);
  space();
  number(ttl);
  space();
  logtype(type);
  space();
  name(q);
  space();
  for (i = 0; (unsigned)i < len; ++i) {
    hex(buf[i]);
    if (i > 30) {
      string("...");
      break;
    }
  }
  line();
}


x86 assembly (clang, -O0):
<log_rr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xe52(%rip),%rdi
call   1040 <string@plt>
mov    -0x8(%rbp),%rdi
call   10a0 <ip@plt>
mov    $0x0,%al
call   1030 <space@plt>
mov    -0x28(%rbp),%edi
call   1070 <number@plt>
mov    $0x0,%al
call   1030 <space@plt>
mov    -0x18(%rbp),%rdi
call   1060 <logtype@plt>
mov    $0x0,%al
call   1030 <space@plt>
mov    -0x10(%rbp),%rdi
call   1050 <name@plt>
mov    $0x0,%al
call   1030 <space@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    1244 <log_rr+0xc4>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1090 <hex@plt>
cmpl   $0x1e,-0x2c(%rbp)
jle    1231 <log_rr+0xb1>
lea    0xde2(%rip),%rdi
call   1040 <string@plt>
jmp    1244 <log_rr+0xc4>
jmp    1236 <log_rr+0xb6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f9 <log_rr+0x79>
mov    $0x0,%al
call   1080 <line@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_rr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r13d
mov    %r8d,%r15d
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xe5c(%rip),%rdi
call   1040 <string@plt>
mov    %rbp,%rdi
call   10a0 <ip@plt>
xor    %eax,%eax
call   1030 <space@plt>
mov    %r13d,%edi
call   1070 <number@plt>
xor    %eax,%eax
call   1030 <space@plt>
mov    %r12,%rdi
call   1060 <logtype@plt>
xor    %eax,%eax
call   1030 <space@plt>
mov    %rbx,%rdi
call   1050 <name@plt>
xor    %eax,%eax
call   1030 <space@plt>
test   %r15d,%r15d
je     1217 <log_rr+0x97>
mov    %r15d,%ebp
xor    %ebx,%ebx
nop
movsbl (%r14,%rbx,1),%edi
call   1090 <hex@plt>
cmp    $0x1f,%rbx
je     120b <log_rr+0x8b>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11f0 <log_rr+0x70>
jmp    1217 <log_rr+0x97>
lea    0xdf7(%rip),%rdi
call   1040 <string@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <line@plt>

LLVM IR (-O0):
@.str = [9 x i8] c" rr \00"
@.str.1 = [4 x i8] c"...\00"
define void @log_rr(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %13
%14 = call i32 @string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %7
%16 = call i32 @ip(i8* %15)
%17 = call i32 (...) @space()
%18 = load i32, i32* %12
%19 = call i32 @number(i32 %18)
%20 = call i32 (...) @space()
%21 = load i8*, i8** %9
%22 = call i32 @logtype(i8* %21)
%23 = call i32 (...) @space()
%24 = load i8*, i8** %8
%25 = call i32 @name(i8* %24)
%26 = call i32 (...) @space()
store i32 0, i32* %13
br label %27
27: ; preds = %43, %6
%28 = load i32, i32* %13
%29 = load i32, i32* %11
%30 = icmp ult i32 %28, %29
br i1 %30, label %31, label %46
31: ; preds = %27
%32 = load i8*, i8** %10
%33 = load i32, i32* %13
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @hex(i8 signext %36)
%38 = load i32, i32* %13
%39 = icmp sgt i32 %38, 30
br i1 %39, label %40, label %42
40: ; preds = %31
%41 = call i32 @string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %46
42: ; preds = %31
br label %43
43: ; preds = %42
%44 = load i32, i32* %13
%45 = add nsw i32 %44, 1
store i32 %45, i32* %13
br label %27
46: ; preds = %40, %27
%47 = call i32 (...) @line()
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c" rr \00"
@.str.1 = [4 x i8] c"...\00"
define void @log_rr(i8* %0, i8* %1, i8* %2, i8* nocapture %3, i32 %4, i32 %5) {
%7 = tail call i32 @string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @ip(i8* %0)
%9 = tail call i32 (...) @space()
%10 = tail call i32 @number(i32 %5)
%11 = tail call i32 (...) @space()
%12 = tail call i32 @logtype(i8* %2)
%13 = tail call i32 (...) @space()
%14 = tail call i32 @name(i8* %1)
%15 = tail call i32 (...) @space()
%16 = icmp eq i32 %4, 0
br i1 %16, label %30, label %17
17: ; preds = %6
%18 = zext i32 %4 to i64
br label %21
19: ; preds = %21
%20 = icmp eq i64 %26, %18
br i1 %20, label %30, label %21
21: ; preds = %17, %19
%22 = phi i64 [ 0, %17 ], [ %26, %19 ]
%23 = getelementptr inbounds i8, i8* %3, i64 %22
%24 = load i8, i8* %23
%25 = tail call i32 @hex(i8 signext %24)
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %22, 31
br i1 %27, label %28, label %19
28: ; preds = %21
%29 = tail call i32 @string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %19, %6, %28
%31 = tail call i32 (...) @line()
ret void
}