#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 /*<<< orphan*/ uuid_string;
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int const, int const,
                            int const, int const, int const, int const,
                            int const, int const, int const, int const,
                            int const, int const, int const, int const,
                            int const, int const);
char *uuid_to_string(const uint8_t *uuid) {
  static char uuid_string[40];
  if (uuid == NULL)
    return NULL;
  snprintf(
      uuid_string, sizeof(uuid_string),
      "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
      uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
      uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14],
      uuid[15]);
  return uuid_string;
}


x86 assembly (clang, -O0):
<uuid_to_string>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdi,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1140 <uuid_to_string+0x30>
movq   $0x0,-0x30(%rbp)
jmp    1231 <uuid_to_string+0x121>
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%eax
mov    -0x38(%rbp),%rdx
mov    0x10(%rdx),%edx
mov    %edx,-0x4c(%rbp)
mov    -0x38(%rbp),%rdx
mov    0x14(%rdx),%edx
mov    %edx,-0x48(%rbp)
mov    -0x38(%rbp),%rdx
mov    0x18(%rdx),%edx
mov    %edx,-0x44(%rbp)
mov    -0x38(%rbp),%rdx
mov    0x1c(%rdx),%edx
mov    %edx,-0x40(%rbp)
mov    -0x38(%rbp),%rdx
mov    0x20(%rdx),%r13d
mov    -0x38(%rbp),%rdx
mov    0x24(%rdx),%r12d
mov    -0x38(%rbp),%rdx
mov    0x28(%rdx),%r15d
mov    -0x38(%rbp),%rdx
mov    0x2c(%rdx),%r14d
mov    -0x38(%rbp),%rdx
mov    0x30(%rdx),%ebx
mov    -0x38(%rbp),%rdx
mov    0x34(%rdx),%r11d
mov    -0x38(%rbp),%rdx
mov    0x38(%rdx),%r10d
mov    -0x38(%rbp),%rdx
mov    0x3c(%rdx),%edx
mov    %edx,-0x3c(%rbp)
lea    0x2e73(%rip),%rdi
mov    $0x28,%esi
lea    0xe27(%rip),%rdx
mov    %eax,(%rsp)
mov    -0x4c(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x48(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x44(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    -0x40(%rbp),%eax
mov    %eax,0x20(%rsp)
mov    -0x3c(%rbp),%eax
mov    %r13d,0x28(%rsp)
mov    %r12d,0x30(%rsp)
mov    %r15d,0x38(%rsp)
mov    %r14d,0x40(%rsp)
mov    %ebx,0x48(%rsp)
mov    %r11d,0x50(%rsp)
mov    %r10d,0x58(%rsp)
mov    %eax,0x60(%rsp)
call   1030 <snprintf@plt>
lea    0x2e13(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<uuid_to_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %rdi,%rdi
je     11c0 <uuid_to_string+0xb0>
mov    (%rdi),%ecx
mov    0x4(%rdi),%r8d
mov    0x8(%rdi),%r9d
mov    0xc(%rdi),%eax
mov    %rax,0x20(%rsp)
mov    0x10(%rdi),%eax
mov    %rax,0x18(%rsp)
mov    0x14(%rdi),%eax
mov    %rax,0x10(%rsp)
mov    0x18(%rdi),%eax
mov    %rax,0x8(%rsp)
mov    0x1c(%rdi),%eax
mov    %rax,(%rsp)
mov    0x20(%rdi),%r13d
mov    0x24(%rdi),%eax
mov    0x28(%rdi),%ebp
mov    0x2c(%rdi),%r10d
mov    0x30(%rdi),%r11d
mov    0x34(%rdi),%r14d
mov    0x38(%rdi),%r15d
mov    0x3c(%rdi),%r12d
sub    $0x8,%rsp
lea    0x2ebf(%rip),%rbx
lea    0xe78(%rip),%rdx
mov    %rbx,%rdi
mov    $0x28,%esi
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
push   %rbp
push   %rax
push   %r13
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
call   1030 <snprintf@plt>
add    $0x70,%rsp
jmp    11c2 <uuid_to_string+0xb2>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@uuid_to_string.uuid_string = internal global [40 x i8] zeroinitializer
@.str = [71 x i8] c"{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\00"
define i8* @uuid_to_string(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* null, i8** %2
br label %57
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 3
%19 = load i32, i32* %18
%20 = load i32*, i32** %3
%21 = getelementptr inbounds i32, i32* %20, i64 4
%22 = load i32, i32* %21
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i64 5
%25 = load i32, i32* %24
%26 = load i32*, i32** %3
%27 = getelementptr inbounds i32, i32* %26, i64 6
%28 = load i32, i32* %27
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 7
%31 = load i32, i32* %30
%32 = load i32*, i32** %3
%33 = getelementptr inbounds i32, i32* %32, i64 8
%34 = load i32, i32* %33
%35 = load i32*, i32** %3
%36 = getelementptr inbounds i32, i32* %35, i64 9
%37 = load i32, i32* %36
%38 = load i32*, i32** %3
%39 = getelementptr inbounds i32, i32* %38, i64 10
%40 = load i32, i32* %39
%41 = load i32*, i32** %3
%42 = getelementptr inbounds i32, i32* %41, i64 11
%43 = load i32, i32* %42
%44 = load i32*, i32** %3
%45 = getelementptr inbounds i32, i32* %44, i64 12
%46 = load i32, i32* %45
%47 = load i32*, i32** %3
%48 = getelementptr inbounds i32, i32* %47, i64 13
%49 = load i32, i32* %48
%50 = load i32*, i32** %3
%51 = getelementptr inbounds i32, i32* %50, i64 14
%52 = load i32, i32* %51
%53 = load i32*, i32** %3
%54 = getelementptr inbounds i32, i32* %53, i64 15
%55 = load i32, i32* %54
%56 = call i32 @snprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @uuid_to_string.uuid_string, i64 0, i64 0), i32 40, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13, i32 %16, i32 %19, i32 %22, i32 %25, i32 %28, i32 %31, i32 %34, i32 %37, i32 %40, i32 %43, i32 %46, i32 %49, i32 %52, i32 %55)
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @uuid_to_string.uuid_string, i64 0, i64 0), i8** %2
br label %57
57: ; preds = %7, %6
%58 = load i8*, i8** %2
ret i8* %58
}

LLVM IR (-O2):
@uuid_to_string.uuid_string = internal global [40 x i8] zeroinitializer
@.str = [71 x i8] c"{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\00"
define i8* @uuid_to_string(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %36, label %3
3: ; preds = %1
%4 = load i32, i32* %0
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %0, i64 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %0, i64 4
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %0, i64 5
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %0, i64 6
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %0, i64 7
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %0, i64 8
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %0, i64 9
%22 = load i32, i32* %21
%23 = getelementptr inbounds i32, i32* %0, i64 10
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %0, i64 11
%26 = load i32, i32* %25
%27 = getelementptr inbounds i32, i32* %0, i64 12
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %0, i64 13
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %0, i64 14
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %0, i64 15
%34 = load i32, i32* %33
%35 = tail call i32 @snprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @uuid_to_string.uuid_string, i64 0, i64 0), i32 40, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26, i32 %28, i32 %30, i32 %32, i32 %34)
br label %36
36: ; preds = %1, %3
%37 = phi i8* [ getelementptr inbounds ([40 x i8], [40 x i8]* @uuid_to_string.uuid_string, i64 0, i64 0), %3 ], [ null, %1 ]
ret i8* %37
}