#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*/ free(char *);
int /*<<< orphan*/ outplain(char *);
int /*<<< orphan*/ strmcat(char **, char *);
int /*<<< orphan*/ strmreplace(char **, char *, char *);
void showVersion(char *app_name, char *app_version) {
  char *buffer = NULL;
  strmcat(&buffer,
          "%1 %2\nCopyright (C) %3 Niels Neumann  "
          "<vatriani.nn@googlemail.com\nLicense GPLv3+: GNU GPL Version 3 or "
          "later <http://gnu.org/licenses/gpl.html>. \nThis is free software: "
          "you are free to change and redistribute it. \nThere is NO WARRANTY, "
          "to the extent permitted by law.\n\n");
  strmreplace(&buffer, "%1", app_name);
  strmreplace(&buffer, "%2", app_version);
  strmreplace(&buffer, "%3", "Mar 18 2022");
  outplain(buffer);
  free(buffer);
}


x86 assembly (clang, -O0):
<showVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1060 <strmcat@plt>
mov    -0x8(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    0xf97(%rip),%rsi
call   1050 <strmreplace@plt>
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    0xf86(%rip),%rsi
call   1050 <strmreplace@plt>
lea    -0x18(%rbp),%rdi
lea    0xf79(%rip),%rsi
lea    0xf75(%rip),%rdx
call   1050 <strmreplace@plt>
mov    -0x18(%rbp),%rdi
call   1040 <outplain@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showVersion>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movq   $0x0,0x8(%rsp)
lea    0xea1(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strmcat@plt>
lea    0xf9b(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
call   1050 <strmreplace@plt>
lea    0xf8c(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <strmreplace@plt>
lea    0xf7d(%rip),%rsi
lea    0xf79(%rip),%rdx
mov    %rbx,%rdi
call   1050 <strmreplace@plt>
mov    0x8(%rsp),%rdi
call   1040 <outplain@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [270 x i8] c"%1 %2\0ACopyright (C) %3 Niels Neumann <vatriani.nn@googlemail.com\0ALicense GPLv3+: GNU GPL Version 3 or later <http://gnu.org/licenses/gpl.html>. \0AThis is free software: you are free to change and redistribute it. \0AThere is NO WARRANTY, to the extent permitted by law.\0A\0A\00"
@.str.1 = [3 x i8] c"%1\00"
@.str.2 = [3 x i8] c"%2\00"
@.str.3 = [3 x i8] c"%3\00"
@.str.4 = [12 x i8] c"Mar 18 2022\00"
define void @showVersion(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* null, i8** %5
%6 = call i32 @strmcat(i8** %5, i8* getelementptr inbounds ([270 x i8], [270 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = call i32 @strmreplace(i8** %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @strmreplace(i8** %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = call i32 @strmreplace(i8** %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%12 = load i8*, i8** %5
%13 = call i32 @outplain(i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @free(i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [270 x i8] c"%1 %2\0ACopyright (C) %3 Niels Neumann <vatriani.nn@googlemail.com\0ALicense GPLv3+: GNU GPL Version 3 or later <http://gnu.org/licenses/gpl.html>. \0AThis is free software: you are free to change and redistribute it. \0AThere is NO WARRANTY, to the extent permitted by law.\0A\0A\00"
@.str.1 = [3 x i8] c"%1\00"
@.str.2 = [3 x i8] c"%2\00"
@.str.3 = [3 x i8] c"%3\00"
@.str.4 = [12 x i8] c"Mar 18 2022\00"
define void @showVersion(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @strmcat(i8** %3, i8* getelementptr inbounds ([270 x i8], [270 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strmreplace(i8** %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = call i32 @strmreplace(i8** %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%8 = call i32 @strmreplace(i8** %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%9 = load i8*, i8** %3
%10 = call i32 @outplain(i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
ret void
}