#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 singSongFor(int numberOfBottles) {
  if (numberOfBottles == 0) {
    printf("There are simply no more bottles of beer on the wall. \n\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\n",
           oneFewer);
    singSongFor(oneFewer);
    printf("Pot a bottle in the recycling, %d empty bottles in the bin. \n",
           numberOfBottles);
  }
}


x86 assembly (clang, -O0):
<singSongFor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1148 <singSongFor+0x28>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118f <singSongFor+0x6f>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xee4(%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    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <singSongFor@plt>
mov    -0x4(%rbp),%esi
lea    0xf27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singSongFor>:
test   %edi,%edi
je     117b <singSongFor+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    0xee0(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <singSongFor@plt>
lea    0xf0a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>
lea    0xf32(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"There are simply no more bottles of beer on the wall. \0A\0A\00"
@.str.1 = [53 x i8] c"%d bottles of beer on the wall, %d bottles of beer.\0A\00"
@.str.2 = [65 x i8] c"Take one down, pass it around, %d bottles of beer on the wall.\0A\0A\00"
@.str.3 = [62 x i8] c"Pot a bottle in the recycling, %d empty bottles in the bin. \0A\00"
define void @singSongFor(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 ([57 x i8], [57 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 ([53 x i8], [53 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 ([65 x i8], [65 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 ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [53 x i8] c"%d bottles of beer on the wall, %d bottles of beer.\0A\00"
@.str.2 = [65 x i8] c"Take one down, pass it around, %d bottles of beer on the wall.\0A\0A\00"
@.str.3 = [62 x i8] c"Pot a bottle in the recycling, %d empty bottles in the bin. \0A\00"
@str = [56 x i8] c"There are simply no more bottles of beer on the wall. \0A\00"
define void @singSongFor(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 ([56 x i8], [56 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 ([53 x i8], [53 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 ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i32 %8)
tail call void @singSongFor(i32 %8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %5
}