#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*/ compute(int);
int /*<<< orphan*/ debug(char *, int);
int /*<<< orphan*/ func2(int);
int /*<<< orphan*/ func3(int);
int rand();
void func1(int a) {
  debug("func1(%d)\n", a);
  compute(100 * a);
  int alea = rand() % 7;
  if (!alea)
    *(int *)0 = 0;
  switch (a % 3) {
  case 0:
    func1(a - 1);
    break;
  case 1:
    func2(a - 1);
    break;
  case 2:
    func3(a - 1);
    break;
  }
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1050 <debug@plt>
imul   $0x64,-0x4(%rbp),%edi
call   1070 <compute@plt>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11a7 <func1+0x47>
xor    %eax,%eax
movl   $0x0,(%rax)
movslq -0x4(%rbp),%rcx
mov    %ecx,%eax
imul   $0x55555556,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
je     11f8 <func1+0x98>
jmp    11d6 <func1+0x76>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1208 <func1+0xa8>
jmp    11e7 <func1+0x87>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1218 <func1+0xb8>
jmp    1223 <func1+0xc3>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <func1@plt>
jmp    1223 <func1+0xc3>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1060 <func2@plt>
jmp    1223 <func1+0xc3>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <func3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
imul   $0x64,%edi,%ebp
lea    0xea0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <debug@plt>
mov    %ebp,%edi
call   1060 <compute@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %ebx,%rax
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
jne    119e <func1+0x4e>
add    $0xffffffff,%ebx
add    $0xffffff9c,%ebp
jmp    1160 <func1+0x10>
cmp    $0x1,%eax
je     11b6 <func1+0x66>
cmp    $0x2,%eax
jne    11c4 <func1+0x74>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <func3@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <func2@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"func1(%d)\0A\00"
define void @func1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @debug(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = mul nsw i32 100, %6
%8 = call i32 @compute(i32 %7)
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 7
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %1
store i32 0, i32* null
br label %14
14: ; preds = %13, %1
%15 = load i32, i32* %2
%16 = srem i32 %15, 3
switch i32 %16, label %28 [
i32 0, label %17
i32 1, label %20
i32 2, label %24
]
17: ; preds = %14
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 1
br label %28
20: ; preds = %14
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 1
%23 = call i32 @func2(i32 %22)
br label %28
24: ; preds = %14
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 1
%27 = call i32 @func3(i32 %26)
br label %28
28: ; preds = %14, %24, %20, %17
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"func1(%d)\0A\00"
define void @func1(i32 %0) {
br label %2
2: ; preds = %11, %1
%3 = phi i32 [ %0, %1 ], [ %12, %11 ]
%4 = tail call i32 @debug(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = mul nsw i32 %3, 100
%6 = tail call i32 @compute(i32 %5)
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 7
%9 = icmp ne i32 %8, 0
tail call void @llvm.assume(i1 %9)
%10 = srem i32 %3, 3
switch i32 %10, label %19 [
i32 0, label %11
i32 1, label %13
i32 2, label %16
]
11: ; preds = %2
%12 = add nsw i32 %3, -1
br label %2
13: ; preds = %2
%14 = add nsw i32 %3, -1
%15 = tail call i32 @func2(i32 %14)
br label %19
16: ; preds = %2
%17 = add nsw i32 %3, -1
%18 = tail call i32 @func3(i32 %17)
br label %19
19: ; preds = %2, %16, %13
ret void
}