#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*/ mapname;
typedef int /*<<< orphan*/ info;

/* Variables and functions */
int /*<<< orphan*/ Info_ValueForKey(char *, char *);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ trap_GetServerinfo(char *, int);
char *BotMapTitle(void) {
  char info[1024];
  static char mapname[128];
  trap_GetServerinfo(info, sizeof(info));
  strncpy(mapname, Info_ValueForKey(info, "mapname"), sizeof(mapname) - 1);
  mapname[sizeof(mapname) - 1] = '\0';
  return mapname;
}


x86 assembly (clang, -O0):
<BotMapTitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
call   1050 <trap_GetServerinfo@plt>
lea    -0x400(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <Info_ValueForKey@plt>
mov    %eax,%esi
lea    0x2ee8(%rip),%rdi
mov    $0x7f,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x2f56(%rip)
lea    0x2ed0(%rip),%rax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BotMapTitle>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <trap_GetServerinfo@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <Info_ValueForKey@plt>
lea    0x2ef2(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x7f,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x2f5b(%rip)
mov    %rbx,%rax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@BotMapTitle.mapname = internal global [128 x i8] zeroinitializer
@.str = [8 x i8] c"mapname\00"
define i8* @BotMapTitle() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @trap_GetServerinfo(i8* %2, i32 1024)
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = call i32 @Info_ValueForKey(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strncpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @BotMapTitle.mapname, i64 0, i64 0), i32 %5, i32 127)
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @BotMapTitle.mapname, i64 0, i64 127)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @BotMapTitle.mapname, i64 0, i64 0)
}

LLVM IR (-O2):
@BotMapTitle.mapname = internal global [128 x i8] zeroinitializer
@.str = [8 x i8] c"mapname\00"
define i8* @BotMapTitle() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @trap_GetServerinfo(i8* %2, i32 1024)
%4 = call i32 @Info_ValueForKey(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @strncpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @BotMapTitle.mapname, i64 0, i64 0), i32 %4, i32 127)
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @BotMapTitle.mapname, i64 0, i64 127)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @BotMapTitle.mapname, i64 0, i64 0)
}