#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");
  } else {
    printf("%d bottles of beer on the wall, %d bottles of beer.\n",
           numberOfBottles, numberOfBottles);
    printf("Take one down, pass it around, %d bottles of beer on the wall.\n\n",
           --numberOfBottles);
    singSongFor(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    117b <singSongFor+0x5b>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
add    $0xffffffff,%esi
mov    %esi,-0x4(%rbp)
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <singSongFor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singSongFor>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
je     1160 <singSongFor+0x40>
mov    %edi,%ebx
lea    0xece(%rip),%r14
lea    0xefc(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1140 <singSongFor+0x20>
lea    0xf0f(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
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 = [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"
define void @singSongFor(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %15
7: ; preds = %1
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
br label %15
15: ; preds = %7, %5
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 = [54 x i8] c"There are simply no more bottles of beer on the wall.\00"
define void @singSongFor(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %5, %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
ret void
5: ; preds = %1, %5
%6 = phi i32 [ %8, %5 ], [ %0, %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 %6, i32 %6)
%8 = add nsw i32 %6, -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)
%10 = icmp eq i32 %8, 0
br i1 %10, label %3, label %5
}