#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 */
char *gettext(char *);
char *realloc(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
char *ipr_end_list(char *body) {
  int start_len = 0;
  char *string_buf = gettext("Selection");
  start_len = strlen(body);
  body = realloc(body, start_len + strlen(string_buf) + 16);
  sprintf(body + start_len, "\n\n%s: %%1", string_buf);
  return body;
}


x86 assembly (clang, -O0):
<ipr_end_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea6(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdi
add    %eax,%esi
add    $0x10,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xe59(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipr_end_list>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xeae(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r12,%rax,1),%esi
add    $0x10,%esi
mov    %r15,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
movslq %r12d,%rdi
add    %rax,%rdi
lea    0xe7e(%rip),%rsi
mov    %r14,%rdx
call   1060 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Selection\00"
@.str.1 = [10 x i8] c"\0A\0A%s: %%1\00"
define i8* @ipr_end_list(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = call i8* @gettext(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %4
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %9, %11
%13 = add nsw i32 %12, 16
%14 = call i8* @realloc(i8* %8, i32 %13)
store i8* %14, i8** %2
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8*, i8** %4
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [10 x i8] c"Selection\00"
@.str.1 = [10 x i8] c"\0A\0A%s: %%1\00"
define i8* @ipr_end_list(i8* %0) {
%2 = tail call i8* @gettext(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %2)
%5 = add i32 %3, 16
%6 = add i32 %5, %4
%7 = tail call i8* @realloc(i8* %0, i32 %6)
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %7, i64 %8
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i8* %7
}