#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 */
int /*<<< orphan*/ check_name(char const *);
char *combine(char, char const *, char *);
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strlen(char const *);
void rhyme_name(const char *name) {
  if (!check_name(name)) {
    printf("%s isn't a name, so I can't rhyme\n", name);
    return;
  }
  char *out = malloc(strlen(name) + 3);
  if (!out) {
    printf("I don't have enough memory to rhyme\n");
    return;
  }
  printf("%s, %s, ", name, name);
  printf("bo-%s\n", combine('b', name, out));
  printf("Banana-fana fo-%s\n", combine('f', name, out));
  printf("Fee-fi mo-%s\n", combine('m', name, out));
  printf("%s!\n", name);
  free(out);
}


x86 assembly (clang, -O0):
<rhyme_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <check_name@plt>
cmp    $0x0,%eax
jne    1195 <rhyme_name+0x35>
mov    -0x8(%rbp),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1266 <rhyme_name+0x106>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11cc <rhyme_name+0x6c>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1266 <rhyme_name+0x106>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x62,%edi
call   1060 <combine@plt>
mov    %rax,%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x66,%edi
call   1060 <combine@plt>
mov    %rax,%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x6d,%edi
call   1060 <combine@plt>
mov    %rax,%rsi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rhyme_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1090 <check_name@plt>
test   %eax,%eax
je     1238 <rhyme_name+0xc8>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x3(%rax),%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     1250 <rhyme_name+0xe0>
mov    %rax,%r14
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x62,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <combine@plt>
lea    0xe60(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x66,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <combine@plt>
lea    0xe46(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x6d,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <combine@plt>
lea    0xe38(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe35(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
lea    0xdc1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <printf@plt>
lea    0xe02(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"%s isn't a name, so I can't rhyme\0A\00"
@.str.1 = [37 x i8] c"I don't have enough memory to rhyme\0A\00"
@.str.2 = [9 x i8] c"%s, %s, \00"
@.str.3 = [7 x i8] c"bo-%s\0A\00"
@.str.4 = [19 x i8] c"Banana-fana fo-%s\0A\00"
@.str.5 = [14 x i8] c"Fee-fi mo-%s\0A\00"
@.str.6 = [5 x i8] c"%s!\0A\00"
define void @rhyme_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @check_name(i8* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %39
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i64 @strlen(i8* %11)
%13 = add nsw i64 %12, 3
%14 = call i8* @malloc(i64 %13)
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = icmp ne i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %10
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %39
19: ; preds = %10
%20 = load i8*, i8** %2
%21 = load i8*, i8** %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i8*, i8** %2
%24 = load i8*, i8** %3
%25 = call i8* @combine(i8 signext 98, i8* %23, i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %2
%28 = load i8*, i8** %3
%29 = call i8* @combine(i8 signext 102, i8* %27, i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %2
%32 = load i8*, i8** %3
%33 = call i8* @combine(i8 signext 109, i8* %31, i8* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %33)
%35 = load i8*, i8** %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %35)
%37 = load i8*, i8** %3
%38 = call i32 @free(i8* %37)
br label %39
39: ; preds = %19, %17, %7
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"%s isn't a name, so I can't rhyme\0A\00"
@.str.2 = [9 x i8] c"%s, %s, \00"
@.str.3 = [7 x i8] c"bo-%s\0A\00"
@.str.4 = [19 x i8] c"Banana-fana fo-%s\0A\00"
@.str.5 = [14 x i8] c"Fee-fi mo-%s\0A\00"
@.str.6 = [5 x i8] c"%s!\0A\00"
@str = [36 x i8] c"I don't have enough memory to rhyme\00"
define void @rhyme_name(i8* %0) {
%2 = tail call i32 @check_name(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %23
6: ; preds = %1
%7 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%8 = add nsw i64 %7, 3
%9 = tail call i8* @malloc(i64 %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %23
13: ; preds = %6
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %0)
%15 = tail call i8* @combine(i8 signext 98, i8* %0, i8* %9)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = tail call i8* @combine(i8 signext 102, i8* %0, i8* %9)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %17)
%19 = tail call i8* @combine(i8 signext 109, i8* %0, i8* %9)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%22 = tail call i32 @free(i8* %9)
br label %23
23: ; preds = %11, %13, %4
ret void
}