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.%02d.%d", "DPDK", 16, 11, 0);
  else
    snprintf(version, sizeof(version), "%s %d.%02d.%d%s%d", "DPDK", 16, 11, 0,
             "-rc", 0 < 16 ? 0 : 0 - 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    118d <rte_version+0x7d>
lea    0x2f01(%rip),%rdi
mov    $0x20,%esi
lea    0xeb5(%rip),%rdx
lea    0xec0(%rip),%rcx
mov    $0x10,%r8d
mov    $0xb,%r9d
xor    %eax,%eax
lea    0xeb0(%rip),%rax
movl   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2eb7(%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    115c <rte_version+0x4c>
sub    $0x8,%rsp
lea    0xef2(%rip),%r10
lea    0x2f14(%rip),%rdi
lea    0xecd(%rip),%rdx
lea    0xed8(%rip),%rcx
mov    $0x20,%esi
mov    $0x10,%r8d
mov    $0xb,%r9d
xor    %eax,%eax
push   $0x0
push   %r10
push   $0x0
call   1030 <snprintf@plt>
add    $0x20,%rsp
lea    0x2edd(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@rte_version.version = internal global [32 x i8] zeroinitializer
@.str = [18 x i8] c"%s %d.%02d.%d%s%d\00"
@.str.1 = [5 x i8] c"DPDK\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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 16, i32 11, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0)
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 = [18 x i8] c"%s %d.%02d.%d%s%d\00"
@.str.1 = [5 x i8] c"DPDK\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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 16, i32 11, i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0)
br label %5
5: ; preds = %0, %3
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
}