#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*/ f1();
scalar_t__ f2();
scalar_t__ f3();
void ff(int fname, int part, int nparts) {
  if (fname) {
    if (nparts)
      f1();
  } else
    fname = 2;
  while (f3()) {
    if (nparts && f2()) {
      f1();
      nparts = part;
      if (f3())
        f1();
      f1();
      break;
    }
  }
  if (nparts)
    f1();
  return;
}


x86 assembly (clang, -O0):
<ff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1161 <ff+0x31>
cmpl   $0x0,-0xc(%rbp)
je     115c <ff+0x2c>
mov    $0x0,%al
call   1050 <f1@plt>
jmp    1168 <ff+0x38>
movl   $0x2,-0x4(%rbp)
jmp    116d <ff+0x3d>
mov    $0x0,%al
call   1040 <f3@plt>
cmp    $0x0,%rax
je     11cf <ff+0x9f>
cmpl   $0x0,-0xc(%rbp)
je     11ca <ff+0x9a>
mov    $0x0,%al
call   1030 <f2@plt>
cmp    $0x0,%rax
je     11ca <ff+0x9a>
mov    $0x0,%al
call   1050 <f1@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <f3@plt>
cmp    $0x0,%rax
je     11be <ff+0x8e>
mov    $0x0,%al
call   1050 <f1@plt>
mov    $0x0,%al
call   1050 <f1@plt>
jmp    11cf <ff+0x9f>
jmp    116d <ff+0x3d>
cmpl   $0x0,-0xc(%rbp)
je     11e0 <ff+0xb0>
mov    $0x0,%al
call   1050 <f1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%ebx
test   %edi,%edi
je     1150 <ff+0x20>
test   %ebp,%ebp
je     1150 <ff+0x20>
xor    %eax,%eax
call   1050 <f1@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <f3@plt>
test   %rax,%rax
je     1198 <ff+0x68>
test   %ebp,%ebp
je     1150 <ff+0x20>
xor    %eax,%eax
call   1030 <f2@plt>
test   %rax,%rax
je     1150 <ff+0x20>
xor    %eax,%eax
call   1050 <f1@plt>
xor    %eax,%eax
call   1040 <f3@plt>
test   %rax,%rax
je     1186 <ff+0x56>
xor    %eax,%eax
call   1050 <f1@plt>
xor    %eax,%eax
call   1050 <f1@plt>
test   %ebx,%ebx
jne    119e <ff+0x6e>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%ebx
test   %ebx,%ebx
je     1191 <ff+0x61>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <f1@plt>

LLVM IR (-O0):
define void @ff(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @f1()
br label %14
14: ; preds = %12, %9
br label %16
15: ; preds = %3
store i32 2, i32* %4
br label %16
16: ; preds = %15, %14
br label %17
17: ; preds = %35, %16
%18 = call i64 (...) @f3()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %36
20: ; preds = %17
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = call i64 (...) @f2()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = call i32 (...) @f1()
%28 = load i32, i32* %5
store i32 %28, i32* %6
%29 = call i64 (...) @f3()
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 (...) @f1()
br label %33
33: ; preds = %31, %26
%34 = call i32 (...) @f1()
br label %36
35: ; preds = %23, %20
br label %17
36: ; preds = %33, %17
%37 = load i32, i32* %6
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 (...) @f1()
br label %41
41: ; preds = %39, %36
ret void
}

LLVM IR (-O2):
define void @ff(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = icmp eq i32 %2, 0
%6 = or i1 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 (...) @f1()
br label %9
9: ; preds = %3, %7
%10 = tail call i64 (...) @f3()
%11 = icmp eq i64 %10, 0
br i1 %11, label %27, label %12
12: ; preds = %9, %24
br i1 %5, label %24, label %13
13: ; preds = %12
%14 = tail call i64 (...) @f2()
%15 = icmp eq i64 %14, 0
br i1 %15, label %24, label %16
16: ; preds = %13
%17 = tail call i32 (...) @f1()
%18 = tail call i64 (...) @f3()
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = tail call i32 (...) @f1()
br label %22
22: ; preds = %20, %16
%23 = tail call i32 (...) @f1()
br label %27
24: ; preds = %13, %12
%25 = tail call i64 (...) @f3()
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %12
27: ; preds = %24, %9, %22
%28 = phi i32 [ %1, %22 ], [ %2, %9 ], [ %2, %24 ]
%29 = icmp eq i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 (...) @f1()
br label %32
32: ; preds = %30, %27
ret void
}