#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*/ exit(int /*<<< orphan*/);
char *installedProblemName(int);
int numberOfInstalledProblems();
int /*<<< orphan*/ printf(char *, ...);
void printAllInstalledProblems(void) {
  int i, n;
  n = numberOfInstalledProblems();
  printf("Installed optimization problems:\n");
  for (i = 0; i < n; i++)
    printf("%3d: %s\n", i, installedProblemName(i));
  exit(0);
}


x86 assembly (clang, -O0):
<printAllInstalledProblems>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <numberOfInstalledProblems@plt>
mov    %eax,-0x8(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a3 <printAllInstalledProblems+0x63>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <installedProblemName@plt>
mov    -0xc(%rbp),%esi
mov    %rax,%rdx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <printAllInstalledProblems+0x27>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<printAllInstalledProblems>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <numberOfInstalledProblems@plt>
mov    %eax,%ebx
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    119d <printAllInstalledProblems+0x4d>
lea    0xe8c(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1050 <installedProblemName@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1180 <printAllInstalledProblems+0x30>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Installed optimization problems:\0A\00"
@.str.1 = [9 x i8] c"%3d: %s\0A\00"
define void @printAllInstalledProblems() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @numberOfInstalledProblems()
store i32 %3, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %17
9: ; preds = %5
%10 = load i32, i32* %1
%11 = load i32, i32* %1
%12 = call i8* @installedProblemName(i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %10, i8* %12)
br label %14
14: ; preds = %9
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %5
17: ; preds = %5
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%3d: %s\0A\00"
@str = [33 x i8] c"Installed optimization problems:\00"
define void @printAllInstalledProblems() {
%1 = tail call i32 (...) @numberOfInstalledProblems()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %0, %4
%5 = phi i32 [ %8, %4 ], [ 0, %0 ]
%6 = tail call i8* @installedProblemName(i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %4, %0
%11 = tail call i32 @exit(i32 0)
unreachable
}