void project_manager_shutdown(void) {
  mydebug(1,
          "[%#lx] %s():%d "
          "",
          pthread_self(), __FUNCTION__, 130);
  char **projects;
  int len;
  db_get_names_project(&projects, &len);
  int i;
  for (i = 0; i < len; i++) {
    project_manager_shutdown_project(projects[i]);
  }
  db_free_names_project(projects, len);
}


x86 assembly (clang, -O0):
<project_manager_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <pthread_self@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe93(%rip),%rsi
lea    0xe9c(%rip),%rcx
mov    $0x82,%r8d
mov    $0x0,%al
call   1050 <mydebug@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1030 <db_get_names_project@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c4 <project_manager_shutdown+0x74>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1040 <project_manager_shutdown_project@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1197 <project_manager_shutdown+0x47>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <db_free_names_project@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<project_manager_shutdown>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <pthread_self@plt>
lea    0xe9d(%rip),%rsi
lea    0xea6(%rip),%rcx
mov    $0x1,%edi
mov    %eax,%edx
mov    $0x82,%r8d
xor    %eax,%eax
call   1050 <mydebug@plt>
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <db_get_names_project@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11be <project_manager_shutdown+0x6e>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
mov    (%rax,%rbx,8),%rdi
xor    %eax,%eax
call   1040 <project_manager_shutdown_project@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rsi
cmp    %rsi,%rbx
jl     11a0 <project_manager_shutdown+0x50>
mov    0x8(%rsp),%rdi
xor    %eax,%eax
call   1070 <db_free_names_project@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"[%#lx] %s():%d \00"
@__FUNCTION__.project_manager_shutdown = [25 x i8] c"project_manager_shutdown\00"
define void @project_manager_shutdown() {
%1 = alloca i8**
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @pthread_self()
%5 = call i32 (i32, i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @mydebug to i32 (i32, i8*, i32, i8*, i32, ...)*)(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__FUNCTION__.project_manager_shutdown, i64 0, i64 0), i32 130)
%6 = call i32 (i8***, i32*, ...) bitcast (i32 (...)* @db_get_names_project to i32 (i8***, i32*, ...)*)(i8*** %1, i32* %2)
store i32 0, i32* %3
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i8**, i8*** %1
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @project_manager_shutdown_project to i32 (i8*, ...)*)(i8* %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %7
21: ; preds = %7
%22 = load i8**, i8*** %1
%23 = load i32, i32* %2
%24 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @db_free_names_project to i32 (i8**, i32, ...)*)(i8** %22, i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"[%#lx] %s():%d \00"
@__FUNCTION__.project_manager_shutdown = [25 x i8] c"project_manager_shutdown\00"
define void @project_manager_shutdown() {
%1 = alloca i8**
%2 = alloca i32
%3 = tail call i32 (...) @pthread_self()
%4 = tail call i32 (i32, i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @mydebug to i32 (i32, i8*, i32, i8*, i32, ...)*)(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__FUNCTION__.project_manager_shutdown, i64 0, i64 0), i32 130)
%5 = bitcast i8*** %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = call i32 (i8***, i32*, ...) bitcast (i32 (...)* @db_get_names_project to i32 (i8***, i32*, ...)*)(i8*** %1, i32* %2)
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %0, %10
%11 = phi i64 [ %16, %10 ], [ 0, %0 ]
%12 = load i8**, i8*** %1
%13 = getelementptr inbounds i8*, i8** %12, i64 %11
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @project_manager_shutdown_project to i32 (i8*, ...)*)(i8* %14)
%16 = add nuw nsw i64 %11, 1
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %10, label %20
20: ; preds = %10, %0
%21 = phi i32 [ %8, %0 ], [ %17, %10 ]
%22 = load i8**, i8*** %1
%23 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @db_free_names_project to i32 (i8**, i32, ...)*)(i8** %22, i32 %21)
ret void
}