#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 *, char *, int, int,
                           int, int);
scalar_t__ strlen(char *);
char *generate_mul_matrix_code(char *mat_1, char *mat_2, char *param_type,
                               int rows_1, int cols_1, int rows_2, int cols_2) {
  char *s = calloc(1, strlen(mat_1) + strlen(mat_2) + strlen(param_type) + 30);
  sprintf(s, "mul_matrix(\"%s\", %s, %s, %d, %d, %d, %d)", param_type, mat_1,
          mat_2, rows_1, cols_1, rows_2, cols_2);
  return s;
}


x86 assembly (clang, -O0):
<generate_mul_matrix_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rsi
add    %rax,%rsi
add    $0x1e,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%r11d
mov    -0x24(%rbp),%r10d
mov    0x10(%rbp),%eax
lea    0xe42(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1050 <sprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_mul_matrix_code>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,0x10(%rsp)
mov    %ecx,0x4(%rsp)
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %r14,%r15
lea    (%rax,%r15,1),%rsi
add    $0x1e,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,%rbp
sub    $0x8,%rsp
lea    0xe6d(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %r13,%r8
mov    0xc(%rsp),%r9d
mov    0x58(%rsp),%eax
push   %rax
push   0x18(%rsp)
push   0x28(%rsp)
call   1050 <sprintf@plt>
add    $0x20,%rsp
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"mul_matrix(\22%s\22, %s, %s, %d, %d, %d, %d)\00"
define i8* @generate_mul_matrix_code(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load i8*, i8** %8
%17 = call i64 @strlen(i8* %16)
%18 = load i8*, i8** %9
%19 = call i64 @strlen(i8* %18)
%20 = add nsw i64 %17, %19
%21 = load i8*, i8** %10
%22 = call i64 @strlen(i8* %21)
%23 = add nsw i64 %20, %22
%24 = add nsw i64 %23, 30
%25 = call i8* @calloc(i32 1, i64 %24)
store i8* %25, i8** %15
%26 = load i8*, i8** %15
%27 = load i8*, i8** %10
%28 = load i8*, i8** %8
%29 = load i8*, i8** %9
%30 = load i32, i32* %11
%31 = load i32, i32* %12
%32 = load i32, i32* %13
%33 = load i32, i32* %14
%34 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %27, i8* %28, i8* %29, i32 %30, i32 %31, i32 %32, i32 %33)
%35 = load i8*, i8** %15
ret i8* %35
}

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