#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*/ snprintf(char *, int, char *, char *, char *, char *, char *,
                            char *, char *, char *);
void pqos_mbm_caption_build(int lwpid, char *buf, int size) {
  if (lwpid == 0)
    snprintf(buf, size, "%6s%15s%10s%10s%14s%14s%10s", "PID", "PROC", "RMA(K)",
             "LMA(K)", "MBAND.TOTAL", "MBAND.LOCAL", "CPU%%");
  else
    snprintf(buf, size, "%6s%15s%10s%10s%14s%14s%10s", "LWP", "PROC", "RMA(K)",
             "LMA(K)", "MBAND.TOTAL", "MBAND.LOCAL", "CPU%%");
}


x86 assembly (clang, -O0):
<pqos_mbm_caption_build>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1189 <pqos_mbm_caption_build+0x79>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    0xec5(%rip),%rdx
lea    0xeda(%rip),%rcx
lea    0xed7(%rip),%r8
lea    0xed5(%rip),%r9
lea    0xed5(%rip),%rbx
lea    0xed5(%rip),%r11
lea    0xeda(%rip),%r10
lea    0xedf(%rip),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <snprintf@plt>
jmp    11e0 <pqos_mbm_caption_build+0xd0>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    0xe69(%rip),%rdx
lea    0xeb3(%rip),%rcx
lea    0xe7b(%rip),%r8
lea    0xe79(%rip),%r9
lea    0xe79(%rip),%rbx
lea    0xe79(%rip),%r11
lea    0xe7e(%rip),%r10
lea    0xe83(%rip),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <snprintf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<pqos_mbm_caption_build>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
lea    0xeff(%rip),%rax
lea    0xf2d(%rip),%rcx
cmove  %rax,%rcx
lea    0xf1c(%rip),%r10
lea    0xf09(%rip),%r11
lea    0xef6(%rip),%rbx
lea    0xee8(%rip),%r14
lea    0xeb5(%rip),%rax
lea    0xece(%rip),%r8
lea    0xecc(%rip),%r9
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
push   %r10
push   %r11
push   %rbx
push   %r14
call   1030 <snprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%6s%15s%10s%10s%14s%14s%10s\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"PROC\00"
@.str.3 = [7 x i8] c"RMA(K)\00"
@.str.4 = [7 x i8] c"LMA(K)\00"
@.str.5 = [12 x i8] c"MBAND.TOTAL\00"
@.str.6 = [12 x i8] c"MBAND.LOCAL\00"
@.str.7 = [6 x i8] c"CPU%%\00"
@.str.8 = [4 x i8] c"LWP\00"
define void @pqos_mbm_caption_build(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @snprintf(i8* %10, i32 %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %17
13: ; preds = %3
%14 = load i8*, i8** %5
%15 = load i32, i32* %6
%16 = call i32 @snprintf(i8* %14, i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %17
17: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"%6s%15s%10s%10s%14s%14s%10s\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"PROC\00"
@.str.3 = [7 x i8] c"RMA(K)\00"
@.str.4 = [7 x i8] c"LMA(K)\00"
@.str.5 = [12 x i8] c"MBAND.TOTAL\00"
@.str.6 = [12 x i8] c"MBAND.LOCAL\00"
@.str.7 = [6 x i8] c"CPU%%\00"
@.str.8 = [4 x i8] c"LWP\00"
define void @pqos_mbm_caption_build(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
%6 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret void
}