#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);
scalar_t__ strlen(char *);
char *generate_minus_matrix_code(char *mat_1, char *mat_2, char *param_type,
                                 int rows, int cols) {
  char *s = calloc(1, strlen(mat_1) + strlen(mat_2) + strlen(param_type) + 30);
  sprintf(s, "minus_matrix(\"%s\", %s, %s, %d, %d)", param_type, mat_1, mat_2,
          rows, cols);
  return s;
}


x86 assembly (clang, -O0):
<generate_minus_matrix_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%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    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
lea    0xe51(%rip),%rsi
mov    %eax,(%rsp)
call   1050 <sprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_minus_matrix_code>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r12d
mov    %ecx,0x14(%rsp)
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1030 <strlen@plt>
add    %rbp,%r14
lea    (%rax,%r14,1),%rsi
add    $0x1e,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,%rbp
mov    %r12d,(%rsp)
lea    0xe74(%rip),%rsi
mov    %rax,%rdi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %r15,%r8
mov    0x14(%rsp),%r9d
call   1050 <sprintf@plt>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"minus_matrix(\22%s\22, %s, %s, %d, %d)\00"
define i8* @generate_minus_matrix_code(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %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 = load i8*, i8** %8
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 %16, %18
%20 = add nsw i64 %19, 30
%21 = call i8* @calloc(i32 1, i64 %20)
store i8* %21, i8** %11
%22 = load i8*, i8** %11
%23 = load i8*, i8** %8
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24, i8* %25, i32 %26, i32 %27)
%29 = load i8*, i8** %11
ret i8* %29
}

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