#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
char *intToType(int);
char *malloc(int);
int /*<<< orphan*/ strncat(char *, char *, int);
char *makeSig(int n, int *args) {
  int i = 0;
  char *buf;
  buf = malloc(32);
  for (i = 0; i < n; i++) {
    strncat(buf, intToType(*args), sizeof(buf));
    strncat(buf, ", ", 1);
    args++;
  }
  return buf;
}


x86 assembly (clang, -O0):
<makeSig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ba <makeSig+0x8a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <intToType@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rsi
mov    $0x8,%edx
call   1040 <strncat@plt>
mov    -0x20(%rbp),%rdi
lea    0xe6a(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncat@plt>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <makeSig+0x2b>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeSig>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    1192 <makeSig+0x62>
mov    %ebp,%r12d
xor    %ebp,%ebp
lea    0xea6(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbp,4),%edi
call   1030 <intToType@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x8,%edx
call   1040 <strncat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1040 <strncat@plt>
add    $0x1,%rbp
cmp    %ebp,%r12d
jne    1160 <makeSig+0x30>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c", \00"
define i8* @makeSig(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 0, i32* %5
%7 = call i8* @malloc(i32 32)
store i8* %7, i8** %6
store i32 0, i32* %5
br label %8
8: ; preds = %22, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i8*, i8** %6
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = call i8* @intToType(i32 %15)
%17 = call i32 @strncat(i8* %13, i8* %16, i32 8)
%18 = load i8*, i8** %6
%19 = call i32 @strncat(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i32 1
store i32* %21, i32** %4
br label %22
22: ; preds = %12
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %8
25: ; preds = %8
%26 = load i8*, i8** %6
ret i8* %26
}

LLVM IR (-O2):
@.str = [3 x i8] c", \00"
define i8* @makeSig(i32 %0, i32* nocapture %1) {
%3 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %2, %5
%6 = phi i32* [ %12, %5 ], [ %1, %2 ]
%7 = phi i32 [ %13, %5 ], [ 0, %2 ]
%8 = load i32, i32* %6
%9 = tail call i8* @intToType(i32 %8)
%10 = tail call i32 @strncat(i8* %3, i8* %9, i32 8)
%11 = tail call i32 @strncat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = getelementptr inbounds i32, i32* %6, i64 1
%13 = add nuw nsw i32 %7, 1
%14 = icmp eq i32 %13, %0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
ret i8* %3
}