#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 */
typedef int u_int8_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
int sprintf(char *, char *, int);
char *format_epu8(__m128i v, char *buf) {
  u_int8_t __attribute__((aligned(16))) v8[16];
  char *ptr = buf;
  int i, j;
  _mm_store_si128((__m128i *)v8, v);
  *ptr++ = '{';
  for (i = 0; i < 16; i++) {
    j = sprintf(ptr, "%u,", v8[i]);
    ptr += j;
  }
  ptr--;
  *ptr++ = '}';
  *ptr = '\0';
  return buf;
}


x86 assembly (clang, -O0):
<format_epu8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <_mm_store_si128@plt>
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x7b,(%rax)
movl   $0x0,-0x5c(%rbp)
cmpl   $0x10,-0x5c(%rbp)
jge    11a0 <format_epu8+0x80>
mov    -0x58(%rbp),%rdi
movslq -0x5c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xe87(%rip),%rsi
call   1040 <sprintf@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    115c <format_epu8+0x3c>
mov    -0x58(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x7d,(%rax)
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_epu8>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%r14
mov    %edi,%esi
mov    %rsp,%rdi
call   1030 <_mm_store_si128@plt>
lea    0x1(%r14),%rdi
movb   $0x7b,(%r14)
mov    (%rsp),%edx
lea    0xeb4(%rip),%r15
mov    %r15,%rsi
call   1040 <sprintf@plt>
cltq
lea    (%r14,%rax,1),%r12
add    $0x1,%r12
mov    0x4(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r12
add    %rbx,%r12
mov    0xc(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r12
add    %rbx,%r12
mov    0x14(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r12
add    %rbx,%r12
mov    0x1c(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r12
add    %rbx,%r12
mov    0x24(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r12
add    %rbx,%r12
mov    0x2c(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x30(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r12
add    %rbx,%r12
mov    0x34(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%r13
add    %r12,%r13
mov    0x38(%rsp),%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
movslq %eax,%rbx
add    %r13,%rbx
mov    0x3c(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <sprintf@plt>
cltq
movw   $0x7d,-0x1(%rax,%rbx,1)
mov    %r14,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u,\00"
define i8* @format_epu8(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [16 x i32]
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
store i8* %9, i8** %6
%10 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
%11 = load i32, i32* %3
%12 = call i32 @_mm_store_si128(i32* %10, i32 %11)
%13 = load i8*, i8** %6
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %6
store i8 123, i8* %13
store i32 0, i32* %7
br label %15
15: ; preds = %29, %2
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 16
br i1 %17, label %18, label %32
18: ; preds = %15
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = load i8*, i8** %6
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %26, i64 %27
store i8* %28, i8** %6
br label %29
29: ; preds = %18
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %15
32: ; preds = %15
%33 = load i8*, i8** %6
%34 = getelementptr inbounds i8, i8* %33, i32 -1
store i8* %34, i8** %6
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %6
store i8 125, i8* %35
%37 = load i8*, i8** %6
store i8 0, i8* %37
%38 = load i8*, i8** %4
ret i8* %38
}

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