#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ verse(char *, int);
void sing(char *buff, int from, int to) {
  strcpy(buff, "");
  char temp[1024];
  for (int i = from; i >= to; --i) {
    verse(temp, i);
    strcat(buff, temp);
    if (i != to)
      strcat(buff, "\n");
  }
}


x86 assembly (clang, -O0):
<sing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x414(%rbp)
mov    -0x414(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     11c7 <sing+0x97>
lea    -0x410(%rbp),%rdi
mov    -0x414(%rbp),%esi
call   1040 <verse@plt>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x414(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11ae <sing+0x7e>
mov    -0x8(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1050 <strcat@plt>
jmp    11b3 <sing+0x83>
mov    -0x414(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x414(%rbp)
jmp    115e <sing+0x2e>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sing>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xeb4(%rip),%rsi
call   1030 <strcpy@plt>
cmp    %ebp,%ebx
jge    1166 <sing+0x36>
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r15
lea    0xe90(%rip),%r12
jmp    1189 <sing+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%eax
cmp    %ebp,%ebx
mov    %eax,%ebx
jle    1156 <sing+0x26>
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <verse@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
cmp    %ebx,%ebp
je     1180 <sing+0x50>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
jmp    1180 <sing+0x50>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"\0A\00"
define void @sing(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [1024 x i8]
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %5
store i32 %11, i32* %8
br label %12
12: ; preds = %30, %3
%13 = load i32, i32* %8
%14 = load i32, i32* %6
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%18 = load i32, i32* %8
%19 = call i32 @verse(i8* %17, i32 %18)
%20 = load i8*, i8** %4
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %16
%27 = load i8*, i8** %4
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %26, %16
br label %30
30: ; preds = %29
%31 = load i32, i32* %8
%32 = add nsw i32 %31, -1
store i32 %32, i32* %8
br label %12
33: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"\0A\00"
define void @sing(i8* %0, i32 %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %1, %2
br i1 %7, label %8, label %9
8: ; preds = %16, %3
ret void
9: ; preds = %3, %16
%10 = phi i32 [ %17, %16 ], [ %1, %3 ]
%11 = call i32 @verse(i8* %6, i32 %10)
%12 = call i32 @strcat(i8* %0, i8* %6)
%13 = icmp eq i32 %10, %2
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %9, %14
%17 = add nsw i32 %10, -1
%18 = icmp sgt i32 %10, %2
br i1 %18, label %9, label %8
}