#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 */
char *lvm_uuid_format(char *);
int /*<<< orphan*/ printf(char *, ...);
int pv_uuid_print(long int pv_uuid_loc, char *buffer) {
  long int pv_uuid_end;
  char uuid[32], *f_uuid;
  int y = 0, x = 0;
  pv_uuid_end = pv_uuid_loc + 32;
  while (y < 32 && pv_uuid_loc < pv_uuid_end) {
    uuid[y] = buffer[pv_uuid_loc];
    y++;
    pv_uuid_loc++;
  }
  f_uuid = lvm_uuid_format(uuid);
  printf("\t-- PV UUID: ");
  for (x = 0; x < 38; x++)
    printf("%c", f_uuid[x]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<pv_uuid_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4c(%rbp)
mov    %al,-0x51(%rbp)
jge    1167 <pv_uuid_print+0x47>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
setl   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    1177 <pv_uuid_print+0x57>
jmp    11a4 <pv_uuid_print+0x84>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x4c(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114a <pv_uuid_print+0x2a>
lea    -0x40(%rbp),%rdi
call   1030 <lvm_uuid_format@plt>
mov    %rax,-0x48(%rbp)
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x50(%rbp)
cmpl   $0x26,-0x50(%rbp)
jge    11f8 <pv_uuid_print+0xd8>
mov    -0x48(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11c6 <pv_uuid_print+0xa6>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pv_uuid_print>:
push   %r14
push   %rbx
sub    $0x28,%rsp
add    %rdi,%rsi
lea    0x1f(%rdi),%rax
cmp    %rax,%rdi
cmovg  %rdi,%rax
sub    %rdi,%rax
cmp    $0x1f,%rax
mov    $0x1f,%edx
cmovb  %rax,%rdx
add    $0x1,%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <memcpy@plt>
mov    %rbx,%rdi
call   1030 <lvm_uuid_format@plt>
mov    %rax,%r14
lea    0xe7a(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
nop
movsbl (%r14,%rbx,1),%edi
call   1040 <putchar@plt>
add    $0x1,%rbx
cmp    $0x26,%rbx
jne    1190 <pv_uuid_print+0x50>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\09-- PV UUID: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @pv_uuid_print(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca [32 x i8]
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i64 %0, i64* %3
store i8* %1, i8** %4
store i32 0, i32* %8
store i32 0, i32* %9
%10 = load i64, i64* %3
%11 = add nsw i64 %10, 32
store i64 %11, i64* %5
br label %12
12: ; preds = %21, %2
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 32
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i64, i64* %3
%17 = load i64, i64* %5
%18 = icmp slt i64 %16, %17
br label %19
19: ; preds = %15, %12
%20 = phi i1 [ false, %12 ], [ %18, %15 ]
br i1 %20, label %21, label %33
21: ; preds = %19
%22 = load i8*, i8** %4
%23 = load i64, i64* %3
%24 = getelementptr inbounds i8, i8* %22, i64 %23
%25 = load i8, i8* %24
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 %27
store i8 %25, i8* %28
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
%31 = load i64, i64* %3
%32 = add nsw i64 %31, 1
store i64 %32, i64* %3
br label %12
33: ; preds = %19
%34 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%35 = call i8* @lvm_uuid_format(i8* %34)
store i8* %35, i8** %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %37
37: ; preds = %48, %33
%38 = load i32, i32* %9
%39 = icmp slt i32 %38, 38
br i1 %39, label %40, label %51
40: ; preds = %37
%41 = load i8*, i8** %7
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %40
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %37
51: ; preds = %37
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\09-- PV UUID: \00"
define i32 @pv_uuid_print(i64 %0, i8* nocapture %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%6 = getelementptr i8, i8* %1, i64 %0
%7 = add i64 %0, 31
%8 = call i64 @llvm.smax.i64(i64 %0, i64 %7)
%9 = sub i64 %8, %0
%10 = call i64 @llvm.umin.i64(i64 %9, i64 31)
%11 = add nuw nsw i64 %10, 1
%12 = call i8* @lvm_uuid_format(i8* %5)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %2, %14
%15 = phi i64 [ 0, %2 ], [ %20, %14 ]
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 @putchar(i32 %18)
%20 = add nuw nsw i64 %15, 1
%21 = icmp eq i64 %20, 38
br i1 %21, label %22, label %14
22: ; preds = %14
%23 = call i32 @putchar(i32 10)
ret i32 0
}