#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 *, unsigned int, unsigned int,
                           unsigned int, unsigned int, unsigned int,
                           unsigned int, unsigned int, unsigned int);
int strlen(char *);
int compose_message(unsigned int *colors, char *target) {
  sprintf(
      target,
      "0:0x%.6x,1:0x%.6x,2:0x%.6x,3:0x%.6x,4:0x%.6x,5:0x%.6x,6:0x%.6x,7:0x%.6x",
      colors[0], colors[1], colors[2], colors[3], colors[4], colors[5],
      colors[6], colors[7]);
  return strlen(target) + 1;
}


x86 assembly (clang, -O0):
<compose_message>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%ebx
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%r11d
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r10d
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%eax
lea    0xe89(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<compose_message>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rdi),%edx
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%r8d
mov    0xc(%rdi),%r9d
mov    0x10(%rdi),%r10d
mov    0x14(%rdi),%r11d
mov    0x18(%rdi),%r14d
mov    0x1c(%rdi),%eax
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
push   %rax
push   %r14
push   %r11
push   %r10
call   1040 <sprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [72 x i8] c"0:0x%.6x,1:0x%.6x,2:0x%.6x,3:0x%.6x,4:0x%.6x,5:0x%.6x,6:0x%.6x,7:0x%.6x\00"
define i32 @compose_message(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 3
%17 = load i32, i32* %16
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 4
%20 = load i32, i32* %19
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 5
%23 = load i32, i32* %22
%24 = load i32*, i32** %3
%25 = getelementptr inbounds i32, i32* %24, i64 6
%26 = load i32, i32* %25
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i64 7
%29 = load i32, i32* %28
%30 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14, i32 %17, i32 %20, i32 %23, i32 %26, i32 %29)
%31 = load i8*, i8** %4
%32 = call i32 @strlen(i8* %31)
%33 = add nsw i32 %32, 1
ret i32 %33
}

LLVM IR (-O2):
@.str = [72 x i8] c"0:0x%.6x,1:0x%.6x,2:0x%.6x,3:0x%.6x,4:0x%.6x,5:0x%.6x,6:0x%.6x,7:0x%.6x\00"
define i32 @compose_message(i32* nocapture %0, i8* %1) {
%3 = load i32, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %0, i64 3
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %0, i64 4
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %0, i64 5
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %0, i64 6
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %0, i64 7
%17 = load i32, i32* %16
%18 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7, i32 %9, i32 %11, i32 %13, i32 %15, i32 %17)
%19 = tail call i32 @strlen(i8* %1)
%20 = add nsw i32 %19, 1
ret i32 %20
}