#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 *calloc(int, scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int, int, char *);
scalar_t__ strlen(char *);
char *generate_exp_matrix_code(char *mat_1, char *param_type, int rows_1,
                               int cols_1, char *exp) {
  char *s = calloc(1, strlen(mat_1) + strlen(param_type) + 30);
  sprintf(s, "exp_matrix(\"%s\", %s, %d, %d, %s)", param_type, mat_1, rows_1,
          cols_1, exp);
  return s;
}


x86 assembly (clang, -O0):
<generate_exp_matrix_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rsi
add    %rax,%rsi
add    $0x1e,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x20(%rbp),%rax
lea    0xe68(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <sprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_exp_matrix_code>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r12
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %rdi,%r13
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%rax,1),%rsi
add    $0x1e,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %r12,(%rsp)
lea    0xe86(%rip),%rsi
mov    %rax,%rdi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r15d,%r8d
mov    %r14d,%r9d
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 = [33 x i8] c"exp_matrix(\22%s\22, %s, %d, %d, %s)\00"
define i8* @generate_exp_matrix_code(i8* %0, i8* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load i8*, i8** %6
%13 = call i64 @strlen(i8* %12)
%14 = load i8*, i8** %7
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %13, %15
%17 = add nsw i64 %16, 30
%18 = call i8* @calloc(i32 1, i64 %17)
store i8* %18, i8** %11
%19 = load i8*, i8** %11
%20 = load i8*, i8** %7
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = load i8*, i8** %10
%25 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %21, i32 %22, i32 %23, i8* %24)
%26 = load i8*, i8** %11
ret i8* %26
}

LLVM IR (-O2):
@.str = [33 x i8] c"exp_matrix(\22%s\22, %s, %d, %d, %s)\00"
define i8* @generate_exp_matrix_code(i8* %0, i8* %1, i32 %2, i32 %3, i8* %4) {
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = add i64 %6, 30
%9 = add i64 %8, %7
%10 = tail call i8* @calloc(i32 1, i64 %9)
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %10, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0, i32 %2, i32 %3, i8* %4)
ret i8* %10
}