const char *rte_version(void) {
  static char version[32];
  if (version[0] != 0)
    return version;
  if (strlen("-rc") == 0)
    snprintf(version, sizeof(version), "%s %d.%d.%d", "RTE", 2, 0, 0);
  else
    snprintf(version, sizeof(version), "%s %d.%d.%d%s%d", "RTE", 2, 0, 0, "-rc",
             1 < 16 ? 1 : 1 - 16);
  return version;
}


x86 assembly (clang, -O0):
<rte_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsbl 0x2f21(%rip),%eax
cmp    $0x0,%eax
je     1138 <rte_version+0x28>
lea    0x2f11(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1188 <rte_version+0x78>
lea    0x2f01(%rip),%rdi
mov    $0x20,%esi
lea    0xeb5(%rip),%rdx
lea    0xebe(%rip),%rcx
mov    $0x2,%r8d
xor    %r9d,%r9d
lea    0xeb2(%rip),%rax
movl   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2ebc(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_version>:
push   %rax
cmpb   $0x0,0x2f28(%rip)
jne    1159 <rte_version+0x49>
sub    $0x8,%rsp
lea    0xeef(%rip),%r10
lea    0x2f14(%rip),%rdi
lea    0xecd(%rip),%rdx
lea    0xed6(%rip),%rcx
mov    $0x20,%esi
mov    $0x2,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
push   $0x1
push   %r10
push   $0x0
call   1030 <snprintf@plt>
add    $0x20,%rsp
lea    0x2ee0(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@rte_version.version = internal global [32 x i8] zeroinitializer
@.str = [16 x i8] c"%s %d.%d.%d%s%d\00"
@.str.1 = [4 x i8] c"RTE\00"
@.str.2 = [4 x i8] c"-rc\00"
define i8* @rte_version() {
%1 = alloca i8*
%2 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i8** %1
br label %8
6: ; preds = %0
%7 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i64 32, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 0, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i8** %1
br label %8
8: ; preds = %6, %5
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@rte_version.version = internal global [32 x i8] zeroinitializer
@.str = [16 x i8] c"%s %d.%d.%d%s%d\00"
@.str.1 = [4 x i8] c"RTE\00"
@.str.2 = [4 x i8] c"-rc\00"
define i8* @rte_version() {
%1 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
%2 = icmp eq i8 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i64 32, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 0, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %5
5: ; preds = %0, %3
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
}