#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 *, int, int, int, int, int, int, int,
                           int);
char *formatMessage(int base, int shoulder, int shoulder1, int elbow,
                    int elbow1, int wrist, int wrot, int grip) {
  char *teststr = malloc(sizeof(char) * 256);
  sprintf(teststr, "Start:%d,%d,%d,%d,%d,%d,%d,%d:End", base, shoulder,
          shoulder1, elbow, elbow1, wrist, wrot, grip);
  return teststr;
}


x86 assembly (clang, -O0):
<formatMessage>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    $0x100,%edi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%ebx
mov    -0x20(%rbp),%r11d
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
lea    0xe88(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatMessage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8,(%rsp)
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x100,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
lea    0xeb0(%rip),%rsi
mov    %rax,%rdi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %r13d,%r8d
mov    %r12d,%r9d
mov    0x48(%rsp),%eax
push   %rax
mov    0x48(%rsp),%eax
push   %rax
push   %r15
push   0x18(%rsp)
call   1040 <sprintf@plt>
add    $0x20,%rsp
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Start:%d,%d,%d,%d,%d,%d,%d,%d:End\00"
define i8* @formatMessage(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%18 = call i8* @malloc(i32 256)
store i8* %18, i8** %17
%19 = load i8*, i8** %17
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = load i32, i32* %11
%23 = load i32, i32* %12
%24 = load i32, i32* %13
%25 = load i32, i32* %14
%26 = load i32, i32* %15
%27 = load i32, i32* %16
%28 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21, i32 %22, i32 %23, i32 %24, i32 %25, i32 %26, i32 %27)
%29 = load i8*, i8** %17
ret i8* %29
}

LLVM IR (-O2):
@.str = [34 x i8] c"Start:%d,%d,%d,%d,%d,%d,%d,%d:End\00"
define noalias i8* @formatMessage(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7)
ret i8* %9
}