#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*/ printf(char *, ...);
void singTheSong(int numberOfBottles) {
  if (numberOfBottles == 0) {
    printf("There are simply no more bottles of beer on the wall.\n");
  } else {
    printf("%d bottles of beer on the wall.  %d bottles of beer.\n",
           numberOfBottles, numberOfBottles);
    int oneFewer = numberOfBottles - 1;
    printf("Take one down, pass it around, %d bottles of beer on the wall.\n",
           oneFewer);
    singTheSong(oneFewer);
    printf("Put a bottle in recycling, %d empty bottles in the bin.\n",
           numberOfBottles);
  }
}


x86 assembly (clang, -O0):
<singTheSong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1148 <singTheSong+0x28>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118f <singTheSong+0x6f>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <singTheSong@plt>
mov    -0x4(%rbp),%esi
lea    0xf25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singTheSong>:
test   %edi,%edi
je     117b <singTheSong+0x4b>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xec0(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%rbx),%ebp
lea    0xee1(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <singTheSong@plt>
lea    0xf0a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>
lea    0xf2d(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"There are simply no more bottles of beer on the wall.\0A\00"
@.str.1 = [54 x i8] c"%d bottles of beer on the wall. %d bottles of beer.\0A\00"
@.str.2 = [64 x i8] c"Take one down, pass it around, %d bottles of beer on the wall.\0A\00"
@.str.3 = [57 x i8] c"Put a bottle in recycling, %d empty bottles in the bin.\0A\00"
define void @singTheSong(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %19
8: ; preds = %1
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [54 x i8] c"%d bottles of beer on the wall. %d bottles of beer.\0A\00"
@.str.2 = [64 x i8] c"Take one down, pass it around, %d bottles of beer on the wall.\0A\00"
@.str.3 = [57 x i8] c"Put a bottle in recycling, %d empty bottles in the bin.\0A\00"
@str = [54 x i8] c"There are simply no more bottles of beer on the wall.\00"
define void @singTheSong(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %6
ret void
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %0)
%8 = add nsw i32 %0, -1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i32 %8)
tail call void @singTheSong(i32 %8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %5
}