#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void DisplayBufferContentsUint8(uint8_t *buffer, uint8_t numberOfElements,
                                char *msg) {
  printf("%s: {", msg);
  for (int i = 0; i < numberOfElements; i++) {
    printf(" %d", buffer[i]);
    if (i < (numberOfElements - 1))
      printf(",");
  }
  printf(" }\n");
}


x86 assembly (clang, -O0):
<DisplayBufferContentsUint8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1193 <DisplayBufferContentsUint8+0x83>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1180 <DisplayBufferContentsUint8+0x70>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1185 <DisplayBufferContentsUint8+0x75>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <DisplayBufferContentsUint8+0x2c>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayBufferContentsUint8>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xeba(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    1198 <DisplayBufferContentsUint8+0x68>
lea    -0x1(%r14),%r12d
mov    %r14d,%r13d
lea    0xea3(%rip),%r14
xor    %ebx,%ebx
jmp    1179 <DisplayBufferContentsUint8+0x49>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1198 <DisplayBufferContentsUint8+0x68>
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r12,%rbx
jae    1170 <DisplayBufferContentsUint8+0x40>
mov    $0x2c,%edi
call   1030 <putchar@plt>
jmp    1170 <DisplayBufferContentsUint8+0x40>
lea    0xe6b(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s: {\00"
@.str.1 = [4 x i8] c" %d\00"
@str = [3 x i8] c" }\00"
define void @DisplayBufferContentsUint8(i32* nocapture %0, i32 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = add nsw i32 %1, -1
%8 = zext i32 %7 to i64
%9 = zext i32 %1 to i64
br label %12
10: ; preds = %20, %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
12: ; preds = %6, %20
%13 = phi i64 [ 0, %6 ], [ %21, %20 ]
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = icmp ult i64 %13, %8
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call i32 @putchar(i32 44)
br label %20
20: ; preds = %12, %18
%21 = add nuw nsw i64 %13, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %10, label %12
}