#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*/ func1(int);
int /*<<< orphan*/ func2(int);
int rand();
void func3(int a) {
  debug("func3(%d)\n", a);
  compute(100 * a);
  int alea = rand() % 5;
  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):
<func3>:
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    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11a7 <func3+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 <func3+0x98>
jmp    11d6 <func3+0x76>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1208 <func3+0xa8>
jmp    11e7 <func3+0x87>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1218 <func3+0xb8>
jmp    1223 <func3+0xc3>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <func1@plt>
jmp    1223 <func3+0xc3>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1060 <func2@plt>
jmp    1223 <func3+0xc3>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <func3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func3>:
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
cmp    $0x2,%eax
jne    11a1 <func3+0x51>
add    $0xffffffff,%ebx
add    $0xffffff9c,%ebp
jmp    1160 <func3+0x10>
cmp    $0x1,%eax
je     11b8 <func3+0x68>
test   %eax,%eax
jne    11c6 <func3+0x76>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <func1@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"func3(%d)\0A\00"
define void @func3(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, 5
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 %21
i32 2, label %25
]
17: ; preds = %14
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 1
%20 = call i32 @func1(i32 %19)
br label %28
21: ; preds = %14
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
%24 = call i32 @func2(i32 %23)
br label %28
25: ; preds = %14
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 1
br label %28
28: ; preds = %14, %25, %21, %17
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"func3(%d)\0A\00"
define void @func3(i32 %0) {
br label %2
2: ; preds = %17, %1
%3 = phi i32 [ %0, %1 ], [ %18, %17 ]
%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, 5
%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 %14
i32 2, label %17
]
11: ; preds = %2
%12 = add nsw i32 %3, -1
%13 = tail call i32 @func1(i32 %12)
br label %19
14: ; preds = %2
%15 = add nsw i32 %3, -1
%16 = tail call i32 @func2(i32 %15)
br label %19
17: ; preds = %2
%18 = add nsw i32 %3, -1
br label %2
19: ; preds = %2, %14, %11
ret void
}