#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 *);
extern int Bar8(int one, int two, int stop) {
  int sum = 0;
  if (stop == 0) {
    printf(" Bar8: once\n");
    sum = Bar8(one, two, 1);
  } else if (stop == 1) {
    printf(" Bar8: twice\n");
    sum = Bar8(one, two, 2);
  } else {
    printf(" Bar8: thrice\n");
    sum = one + two;
  }
  return sum;
}


x86 assembly (clang, -O0):
<Bar8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1166 <Bar8+0x46>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
call   1040 <Bar8@plt>
mov    %eax,-0x10(%rbp)
jmp    11ae <Bar8+0x8e>
cmpl   $0x1,-0xc(%rbp)
jne    1194 <Bar8+0x74>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x2,%edx
call   1040 <Bar8@plt>
mov    %eax,-0x10(%rbp)
jmp    11a9 <Bar8+0x89>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11ae <Bar8+0x8e>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bar8>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
lea    0xefb(%rip),%rbp
test   %edx,%edx
jne    1141 <Bar8+0x31>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    $0x1,%edx
test   %edx,%edx
je     1130 <Bar8+0x20>
cmp    $0x1,%edx
jne    1152 <Bar8+0x42>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
add    %r14d,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@str = [14 x i8] c" Bar8: thrice\00"
@str.3 = [13 x i8] c" Bar8: twice\00"
@str.4 = [12 x i8] c" Bar8: once\00"
define i32 @Bar8(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %6, %3
%5 = phi i32 [ %2, %3 ], [ 1, %6 ]
switch i32 %5, label %11 [
i32 0, label %6
i32 1, label %8
]
6: ; preds = %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
br label %4
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.3, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %13
11: ; preds = %4
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %8, %11
%14 = add nsw i32 %1, %0
ret i32 %14
}