#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*/ sprintf(char *, char *, int);
void convert_reply(char *out, unsigned char *in) {
  int x;
  for (x = 0; x < 16; x++)
    out += sprintf(out, "%2.2x", (int)in[x]);
}


x86 assembly (clang, -O0):
<convert_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    116b <convert_reply+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xeb8(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <convert_reply+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_reply>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r15
movzbl (%rsi),%edx
lea    0xed8(%rip),%r14
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0x1(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0x2(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0x3(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0x4(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0x5(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0x6(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0x7(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0x8(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0x9(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0xa(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0xb(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0xc(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rbx
add    %r15,%rbx
movzbl 0xd(%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%r15
add    %rbx,%r15
movzbl 0xe(%r12),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <sprintf@plt>
movslq %eax,%rdi
add    %r15,%rdi
movzbl 0xf(%r12),%edx
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%2.2x\00"
define void @convert_reply(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %21, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i8*, i8** %3
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8* %20, i8** %3
br label %21
21: ; preds = %9
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%2.2x\00"
define void @convert_reply(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %7, i64 %12
%14 = getelementptr inbounds i8, i8* %1, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = tail call i32 @sprintf(i8* dereferenceable(1) %13, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %13, i64 %18
%20 = getelementptr inbounds i8, i8* %1, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = tail call i32 @sprintf(i8* dereferenceable(1) %19, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %19, i64 %24
%26 = getelementptr inbounds i8, i8* %1, i64 4
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = tail call i32 @sprintf(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %25, i64 %30
%32 = getelementptr inbounds i8, i8* %1, i64 5
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = tail call i32 @sprintf(i8* dereferenceable(1) %31, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %31, i64 %36
%38 = getelementptr inbounds i8, i8* %1, i64 6
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = tail call i32 @sprintf(i8* dereferenceable(1) %37, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %37, i64 %42
%44 = getelementptr inbounds i8, i8* %1, i64 7
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = tail call i32 @sprintf(i8* dereferenceable(1) %43, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %43, i64 %48
%50 = getelementptr inbounds i8, i8* %1, i64 8
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = tail call i32 @sprintf(i8* dereferenceable(1) %49, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %52)
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %49, i64 %54
%56 = getelementptr inbounds i8, i8* %1, i64 9
%57 = load i8, i8* %56
%58 = zext i8 %57 to i32
%59 = tail call i32 @sprintf(i8* dereferenceable(1) %55, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %58)
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %55, i64 %60
%62 = getelementptr inbounds i8, i8* %1, i64 10
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = tail call i32 @sprintf(i8* dereferenceable(1) %61, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %64)
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %61, i64 %66
%68 = getelementptr inbounds i8, i8* %1, i64 11
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = tail call i32 @sprintf(i8* dereferenceable(1) %67, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %70)
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %67, i64 %72
%74 = getelementptr inbounds i8, i8* %1, i64 12
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = tail call i32 @sprintf(i8* dereferenceable(1) %73, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %76)
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %73, i64 %78
%80 = getelementptr inbounds i8, i8* %1, i64 13
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = tail call i32 @sprintf(i8* dereferenceable(1) %79, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %82)
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8, i8* %79, i64 %84
%86 = getelementptr inbounds i8, i8* %1, i64 14
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = tail call i32 @sprintf(i8* dereferenceable(1) %85, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %88)
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %85, i64 %90
%92 = getelementptr inbounds i8, i8* %1, i64 15
%93 = load i8, i8* %92
%94 = zext i8 %93 to i32
%95 = tail call i32 @sprintf(i8* dereferenceable(1) %91, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %94)
ret void
}