#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 */
scalar_t__ do_dpm_calculation();
scalar_t__ do_finite_field_calculation();
int /*<<< orphan*/ init_Basis();
int number_of_electrons();
int /*<<< orphan*/ rhf_clean();
int /*<<< orphan*/ rhf_dpm_calculation();
int /*<<< orphan*/ rhf_energy();
int /*<<< orphan*/ rhf_finite_field_calculation();
int /*<<< orphan*/ rhf_init();
int spin_multiplicity();
int /*<<< orphan*/ uhf_clean();
int /*<<< orphan*/ uhf_dpm_calculation();
int /*<<< orphan*/ uhf_energy();
int /*<<< orphan*/ uhf_finite_field_calculation();
int /*<<< orphan*/ uhf_init();
int main(int argc, char **argv) {
  int ne, sm;
  init_Basis();
  ne = number_of_electrons();
  sm = spin_multiplicity();
  if (!(ne % 2) && (sm == 1)) {
    rhf_init();
    rhf_energy();
    if (do_finite_field_calculation())
      rhf_finite_field_calculation();
    if (do_dpm_calculation())
      rhf_dpm_calculation();
    rhf_clean();
  } else {
    uhf_init();
    uhf_energy();
    if (do_finite_field_calculation())
      uhf_finite_field_calculation();
    if (do_dpm_calculation())
      uhf_dpm_calculation();
    uhf_clean();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1080 <init_Basis@plt>
mov    $0x0,%al
call   10d0 <number_of_electrons@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   10b0 <spin_multiplicity@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1289 <main+0x99>
cmpl   $0x1,-0x18(%rbp)
jne    1289 <main+0x99>
mov    $0x0,%al
call   1060 <rhf_init@plt>
mov    $0x0,%al
call   1110 <rhf_energy@plt>
mov    $0x0,%al
call   1040 <do_finite_field_calculation@plt>
cmp    $0x0,%rax
je     1265 <main+0x75>
mov    $0x0,%al
call   1050 <rhf_finite_field_calculation@plt>
mov    $0x0,%al
call   10a0 <do_dpm_calculation@plt>
cmp    $0x0,%rax
je     127d <main+0x8d>
mov    $0x0,%al
call   1090 <rhf_dpm_calculation@plt>
mov    $0x0,%al
call   1100 <rhf_clean@plt>
jmp    12ce <main+0xde>
mov    $0x0,%al
call   10e0 <uhf_init@plt>
mov    $0x0,%al
call   1030 <uhf_energy@plt>
mov    $0x0,%al
call   1040 <do_finite_field_calculation@plt>
cmp    $0x0,%rax
je     12af <main+0xbf>
mov    $0x0,%al
call   10f0 <uhf_finite_field_calculation@plt>
mov    $0x0,%al
call   10a0 <do_dpm_calculation@plt>
cmp    $0x0,%rax
je     12c7 <main+0xd7>
mov    $0x0,%al
call   10c0 <uhf_dpm_calculation@plt>
mov    $0x0,%al
call   1070 <uhf_clean@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1080 <init_Basis@plt>
xor    %eax,%eax
call   10d0 <number_of_electrons@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10b0 <spin_multiplicity@plt>
test   $0x1,%bl
jne    124f <main+0x5f>
cmp    $0x1,%eax
jne    124f <main+0x5f>
xor    %eax,%eax
call   1060 <rhf_init@plt>
xor    %eax,%eax
call   1110 <rhf_energy@plt>
xor    %eax,%eax
call   1040 <do_finite_field_calculation@plt>
test   %rax,%rax
je     1233 <main+0x43>
xor    %eax,%eax
call   1050 <rhf_finite_field_calculation@plt>
xor    %eax,%eax
call   10a0 <do_dpm_calculation@plt>
test   %rax,%rax
je     1246 <main+0x56>
xor    %eax,%eax
call   1090 <rhf_dpm_calculation@plt>
xor    %eax,%eax
call   1100 <rhf_clean@plt>
jmp    128a <main+0x9a>
xor    %eax,%eax
call   10e0 <uhf_init@plt>
xor    %eax,%eax
call   1030 <uhf_energy@plt>
xor    %eax,%eax
call   1040 <do_finite_field_calculation@plt>
test   %rax,%rax
je     1270 <main+0x80>
xor    %eax,%eax
call   10f0 <uhf_finite_field_calculation@plt>
xor    %eax,%eax
call   10a0 <do_dpm_calculation@plt>
test   %rax,%rax
je     1283 <main+0x93>
xor    %eax,%eax
call   10c0 <uhf_dpm_calculation@plt>
xor    %eax,%eax
call   1070 <uhf_clean@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @init_Basis()
%9 = call i32 (...) @number_of_electrons()
store i32 %9, i32* %6
%10 = call i32 (...) @spin_multiplicity()
store i32 %10, i32* %7
%11 = load i32, i32* %6
%12 = srem i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %31, label %14
14: ; preds = %2
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = call i32 (...) @rhf_init()
%19 = call i32 (...) @rhf_energy()
%20 = call i64 (...) @do_finite_field_calculation()
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 (...) @rhf_finite_field_calculation()
br label %24
24: ; preds = %22, %17
%25 = call i64 (...) @do_dpm_calculation()
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (...) @rhf_dpm_calculation()
br label %29
29: ; preds = %27, %24
%30 = call i32 (...) @rhf_clean()
br label %45
31: ; preds = %14, %2
%32 = call i32 (...) @uhf_init()
%33 = call i32 (...) @uhf_energy()
%34 = call i64 (...) @do_finite_field_calculation()
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 (...) @uhf_finite_field_calculation()
br label %38
38: ; preds = %36, %31
%39 = call i64 (...) @do_dpm_calculation()
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (...) @uhf_dpm_calculation()
br label %43
43: ; preds = %41, %38
%44 = call i32 (...) @uhf_clean()
br label %45
45: ; preds = %43, %29
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init_Basis()
%4 = tail call i32 (...) @number_of_electrons()
%5 = tail call i32 (...) @spin_multiplicity()
%6 = and i32 %4, 1
%7 = icmp eq i32 %6, 0
%8 = icmp eq i32 %5, 1
%9 = select i1 %7, i1 %8, i1 false
br i1 %9, label %10, label %24
10: ; preds = %2
%11 = tail call i32 (...) @rhf_init()
%12 = tail call i32 (...) @rhf_energy()
%13 = tail call i64 (...) @do_finite_field_calculation()
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = tail call i32 (...) @rhf_finite_field_calculation()
br label %17
17: ; preds = %15, %10
%18 = tail call i64 (...) @do_dpm_calculation()
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 (...) @rhf_dpm_calculation()
br label %22
22: ; preds = %20, %17
%23 = tail call i32 (...) @rhf_clean()
br label %38
24: ; preds = %2
%25 = tail call i32 (...) @uhf_init()
%26 = tail call i32 (...) @uhf_energy()
%27 = tail call i64 (...) @do_finite_field_calculation()
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = tail call i32 (...) @uhf_finite_field_calculation()
br label %31
31: ; preds = %29, %24
%32 = tail call i64 (...) @do_dpm_calculation()
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = tail call i32 (...) @uhf_dpm_calculation()
br label %36
36: ; preds = %34, %31
%37 = tail call i32 (...) @uhf_clean()
br label %38
38: ; preds = %36, %22
ret i32 0
}