void project_manager_restart_processes(const char *proj_name) {
  assert(proj_name);
  if (proj_name) {
    int minproc = config_get_min_idle_processes(proj_name);
    int activeproc = db_get_num_active_process(proj_name);
    int numproc = ({
      __typeof__(minproc) _a = (minproc);
      __typeof__(activeproc) _b = (activeproc);
      _a > _b ? _a : _b;
    });
    process_manager_start_new_process_detached(numproc, proj_name, 1);
  }
}


x86 assembly (clang, -O0):
<project_manager_restart_processes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1060 <assert@plt>
cmpq   $0x0,-0x8(%rbp)
je     11c6 <project_manager_restart_processes+0x86>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <config_get_min_idle_processes@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <db_get_num_active_process@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11a1 <project_manager_restart_processes+0x61>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11a7 <project_manager_restart_processes+0x67>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1040 <process_manager_start_new_process_detached@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<project_manager_restart_processes>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <assert@plt>
test   %rbx,%rbx
je     1184 <project_manager_restart_processes+0x44>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <config_get_min_idle_processes@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <db_get_num_active_process@plt>
cmp    %eax,%ebp
cmovle %eax,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <process_manager_start_new_process_detached@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @project_manager_restart_processes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %9)
%11 = load i8*, i8** %2
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %33
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @config_get_min_idle_processes to i32 (i8*, ...)*)(i8* %14)
store i32 %15, i32* %3
%16 = load i8*, i8** %2
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @db_get_num_active_process to i32 (i8*, ...)*)(i8* %16)
store i32 %17, i32* %4
%18 = load i32, i32* %3
store i32 %18, i32* %6
%19 = load i32, i32* %4
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = load i32, i32* %6
br label %27
25: ; preds = %13
%26 = load i32, i32* %7
br label %27
27: ; preds = %25, %23
%28 = phi i32 [ %24, %23 ], [ %26, %25 ]
store i32 %28, i32* %8
%29 = load i32, i32* %8
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = load i8*, i8** %2
%32 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @process_manager_start_new_process_detached to i32 (i32, i8*, i32, ...)*)(i32 %30, i8* %31, i32 1)
br label %33
33: ; preds = %27, %1
ret void
}

LLVM IR (-O2):
define void @project_manager_restart_processes(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %0)
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @config_get_min_idle_processes to i32 (i8*, ...)*)(i8* %0)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @db_get_num_active_process to i32 (i8*, ...)*)(i8* %0)
%7 = icmp sgt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 %6
%9 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @process_manager_start_new_process_detached to i32 (i32, i8*, i32, ...)*)(i32 %8, i8* %0, i32 1)
br label %10
10: ; preds = %4, %1
ret void
}