#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 /*<<< orphan*/ item_name;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
const char *buflist_bar_item_get_name(int index) {
  static char item_name[32];
  if (index == 0) {
    snprintf(item_name, sizeof(item_name), "%s", "buflist");
  } else {
    snprintf(item_name, sizeof(item_name), "%s%d", "buflist", index + 1);
  }
  return item_name;
}


x86 assembly (clang, -O0):
<buflist_bar_item_get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114b <buflist_bar_item_get_name+0x3b>
lea    0x2f14(%rip),%rdi
mov    $0x20,%esi
lea    0xec8(%rip),%rdx
lea    0xec4(%rip),%rcx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1174 <buflist_bar_item_get_name+0x64>
mov    -0x4(%rbp),%r8d
add    $0x1,%r8d
lea    0x2ee6(%rip),%rdi
mov    $0x20,%esi
lea    0xea5(%rip),%rdx
lea    0xe96(%rip),%rcx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2ec5(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buflist_bar_item_get_name>:
push   %rax
test   %edi,%edi
je     113f <buflist_bar_item_get_name+0x2f>
mov    %edi,%r8d
add    $0x1,%r8d
lea    0x2f1d(%rip),%rdi
lea    0xee1(%rip),%rdx
lea    0xed2(%rip),%rcx
mov    $0x20,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    1160 <buflist_bar_item_get_name+0x50>
lea    0x2efa(%rip),%rdi
lea    0xeb3(%rip),%rdx
lea    0xeaf(%rip),%rcx
mov    $0x20,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x2ed9(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@buflist_bar_item_get_name.item_name = internal global [32 x i8] zeroinitializer
@.str = [3 x i8] c"%s\00"
@.str.1 = [8 x i8] c"buflist\00"
@.str.2 = [5 x i8] c"%s%d\00"
define i8* @buflist_bar_item_get_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @buflist_bar_item_get_name.item_name, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
%10 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @buflist_bar_item_get_name.item_name, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7, %5
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @buflist_bar_item_get_name.item_name, i64 0, i64 0)
}

LLVM IR (-O2):
@buflist_bar_item_get_name.item_name = internal global [32 x i8] zeroinitializer
@.str = [3 x i8] c"%s\00"
@.str.1 = [8 x i8] c"buflist\00"
@.str.2 = [5 x i8] c"%s%d\00"
define i8* @buflist_bar_item_get_name(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @buflist_bar_item_get_name.item_name, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %8
5: ; preds = %1
%6 = add nsw i32 %0, 1
%7 = tail call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @buflist_bar_item_get_name.item_name, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %3
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @buflist_bar_item_get_name.item_name, i64 0, i64 0)
}