#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*/ printf(char *, char *, unsigned char);
void show_guid(unsigned char *pguid) {
  char *s;
  int i;
  for (i = 0; i < 16; i++) {
    if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
      s = "-";
    else
      s = "";
    printf("%s%02x", s, pguid[i]);
  }
}


x86 assembly (clang, -O0):
<show_guid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    119a <show_guid+0x8a>
cmpl   $0x4,-0x14(%rbp)
je     1155 <show_guid+0x45>
cmpl   $0x6,-0x14(%rbp)
je     1155 <show_guid+0x45>
cmpl   $0x8,-0x14(%rbp)
je     1155 <show_guid+0x45>
cmpl   $0xa,-0x14(%rbp)
jne    1165 <show_guid+0x55>
lea    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1170 <show_guid+0x60>
lea    0xe95(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
lea    0xe7f(%rip),%rdi
movzbl (%rax,%rcx,1),%edx
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <show_guid+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_guid>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xedb(%rip),%r12
lea    0xed5(%rip),%r13
lea    0xecf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%eax
and    $0x7ffffffd,%eax
add    $0xfffffffc,%eax
test   $0xfffffff9,%eax
mov    %r13,%rsi
cmove  %r12,%rsi
movzbl (%r15,%rbx,1),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
jne    1140 <show_guid+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [7 x i8] c"%s%02x\00"
define void @show_guid(i8* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %13, %2 ]
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 2147483645
%6 = icmp eq i32 %5, 4
%7 = icmp eq i32 %5, 8
%8 = or i1 %7, %6
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%10 = getelementptr inbounds i8, i8* %0, i64 %3
%11 = load i8, i8* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8 zeroext %11)
%13 = add nuw nsw i64 %3, 1
%14 = icmp eq i64 %13, 16
br i1 %14, label %15, label %2
15: ; preds = %2
ret void
}