#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 *UTIL_mallocStr(size_t);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *OC_mkVarDef(char *varName, char *defs) {
  size_t length = strlen(varName) + strlen(defs) + 10;
  char *vardef = UTIL_mallocStr(length + 1);
  strcpy(vardef, "let ");
  strcat(vardef, varName);
  strcat(vardef, " = ");
  strcat(vardef, defs);
  return vardef;
}


x86 assembly (clang, -O0):
<OC_mkVarDef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
add    $0xa,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OC_mkVarDef>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %ebp,%eax
movslq %eax,%rdi
add    $0xb,%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,%rbp
lea    0xe8f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xe7a(%rip),%rsi
mov    %rbp,%rdi
call   1060 <strcat@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"let \00"
@.str.1 = [4 x i8] c" = \00"
define i8* @OC_mkVarDef(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %8, %10
%12 = add nsw i32 %11, 10
%13 = sext i32 %12 to i64
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = add i64 %14, 1
%16 = call i8* @UTIL_mallocStr(i64 %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = load i8*, i8** %6
%20 = load i8*, i8** %3
%21 = call i32 @strcat(i8* %19, i8* %20)
%22 = load i8*, i8** %6
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8*, i8** %6
%25 = load i8*, i8** %4
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = load i8*, i8** %6
ret i8* %27
}

LLVM IR (-O2):
@.str = [5 x i8] c"let \00"
@.str.1 = [4 x i8] c" = \00"
define i8* @OC_mkVarDef(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add nsw i32 %4, %3
%6 = sext i32 %5 to i64
%7 = add nsw i64 %6, 11
%8 = tail call i8* @UTIL_mallocStr(i64 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @strcat(i8* %8, i8* %0)
%11 = tail call i32 @strcat(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @strcat(i8* %8, i8* %1)
ret i8* %8
}