#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*/ decode(int *);
int /*<<< orphan*/ printf(char *, ...);
void composeBinaryMessage(uint8_t *buffer, int size) {
  printf("0: ");
  for (int i = 0; i < size; i++) {
    printf("%X ", buffer[i]);
    if (i % 10 == 0) {
      printf("\n%d: ", i + 1);
    }
  }
  decode(buffer);
}


x86 assembly (clang, -O0):
<composeBinaryMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a4 <composeBinaryMessage+0x84>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1191 <composeBinaryMessage+0x71>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <composeBinaryMessage+0x76>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <composeBinaryMessage+0x24>
mov    -0x8(%rbp),%rdi
call   1040 <decode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<composeBinaryMessage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r12
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
jle    1197 <composeBinaryMessage+0x77>
mov    %ebx,%r13d
lea    0xeb8(%rip),%r14
xor    %ebx,%ebx
jmp    1158 <composeBinaryMessage+0x38>
mov    %r15,%rbx
cmp    %r15,%r13
je     1197 <composeBinaryMessage+0x77>
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%ebp
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1(%rbx),%r15
cmp    %ebp,%ebx
jne    1150 <composeBinaryMessage+0x30>
add    $0x1,%ebx
lea    0xe7c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1150 <composeBinaryMessage+0x30>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <decode@plt>

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

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