#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 *malloc(int);
int /*<<< orphan*/ sprintf(char *, char const *, char const *, char const *);
int strlen(char const *);
char *make_abbrevitem(const char *abbrev_short, const char *abbrev_full) {
  const char *fmt_str = "\\abbrevitem{%s}{%s}\n";
  const int fmt_str_len = strlen(fmt_str) - strlen("%s%s");
  char *ret_str;
  ret_str = malloc(sizeof(char) * (fmt_str_len + strlen(abbrev_short) +
                                   strlen(abbrev_full) + 1));
  sprintf(ret_str, fmt_str, abbrev_short, abbrev_full);
  return ret_str;
}


x86 assembly (clang, -O0):
<make_abbrevitem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
call   1050 <sprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_abbrevitem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xeb8(%rip),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
lea    0xebc(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %r13d,%ebx
add    %ebp,%ebx
lea    (%rax,%rbx,1),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\\abbrevitem{%s}{%s}\0A\00"
@.str.1 = [5 x i8] c"%s%s\00"
define i8* @make_abbrevitem(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = sub nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = load i8*, i8** %3
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %12, %14
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
%18 = add nsw i32 %15, %17
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = mul i64 1, %20
%22 = trunc i64 %21 to i32
%23 = call i8* @malloc(i32 %22)
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = load i8*, i8** %5
%26 = load i8*, i8** %3
%27 = load i8*, i8** %4
%28 = call i32 @sprintf(i8* %24, i8* %25, i8* %26, i8* %27)
%29 = load i8*, i8** %7
ret i8* %29
}

LLVM IR (-O2):
@.str = [21 x i8] c"\\abbrevitem{%s}{%s}\0A\00"
@.str.1 = [5 x i8] c"%s%s\00"
define noalias i8* @make_abbrevitem(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @strlen(i8* %1)
%7 = add i32 %3, 1
%8 = sub i32 %7, %4
%9 = add i32 %8, %5
%10 = add i32 %9, %6
%11 = tail call i8* @malloc(i32 %10)
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %11, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* %11
}