#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
char *strerror(int);
int cobaye_report_stdout(int type, char *name, int iter, char *str, int id) {
  switch (type) {
  case 1:
    break;
  case 3:
    printf("********************************\n");
    printf("Running %s #%d\n", name, iter);
    break;
  case 5:
    printf("%s(%d): Error %d: %s\n", name, iter, id, strerror(id));
    break;
  case 6:
    printf("%s(%d): Success\n", name, iter);
    break;
  case 4:
    printf("%s(%d): Skip\n", name, iter);
    break;
  case 7:
    printf("%s(%d): Fail %d\n", name, iter, id);
    break;
  case 8:
    printf("%s", str);
    fflush(stdout);
    break;
  case 9:
    break;
  default:
    break;
  }
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<cobaye_report_stdout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x8,%eax
ja     1257 <cobaye_report_stdout+0x127>
mov    -0x30(%rbp),%rax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    125c <cobaye_report_stdout+0x12c>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <cobaye_report_stdout+0x12c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x24(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    %rax,%r8
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <cobaye_report_stdout+0x12c>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <cobaye_report_stdout+0x12c>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <cobaye_report_stdout+0x12c>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <cobaye_report_stdout+0x12c>
mov    -0x20(%rbp),%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    125c <cobaye_report_stdout+0x12c>
jmp    125c <cobaye_report_stdout+0x12c>
jmp    125c <cobaye_report_stdout+0x12c>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cobaye_report_stdout>:
push   %rbp
push   %r14
push   %rbx
add    $0xfffffffd,%edi
cmp    $0x5,%edi
ja     11f6 <cobaye_report_stdout+0xb6>
mov    %r8d,%ebp
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0xea0(%rip),%rax
movslq (%rax,%rdi,4),%rdx
add    %rax,%rdx
jmp    *%rdx
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
jmp    11b0 <cobaye_report_stdout+0x70>
lea    0xeca(%rip),%rdi
jmp    11b0 <cobaye_report_stdout+0x70>
mov    %ebp,%edi
call   1060 <strerror@plt>
lea    0xe93(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f6 <cobaye_report_stdout+0xb6>
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f6 <cobaye_report_stdout+0xb6>
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f6 <cobaye_report_stdout+0xb6>
lea    0xe90(%rip),%rdi
mov    %rcx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"********************************\0A\00"
@.str.1 = [16 x i8] c"Running %s #%d\0A\00"
@.str.2 = [22 x i8] c"%s(%d): Error %d: %s\0A\00"
@.str.3 = [17 x i8] c"%s(%d): Success\0A\00"
@.str.4 = [14 x i8] c"%s(%d): Skip\0A\00"
@.str.5 = [17 x i8] c"%s(%d): Fail %d\0A\00"
@.str.6 = [3 x i8] c"%s\00"
@stdout = global i32 0
define i32 @cobaye_report_stdout(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
switch i32 %11, label %44 [
i32 1, label %12
i32 3, label %13
i32 5, label %18
i32 6, label %25
i32 4, label %29
i32 7, label %33
i32 8, label %38
i32 9, label %43
]
12: ; preds = %5
br label %45
13: ; preds = %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %16)
br label %45
18: ; preds = %5
%19 = load i8*, i8** %7
%20 = load i32, i32* %8
%21 = load i32, i32* %10
%22 = load i32, i32* %10
%23 = call i8* @strerror(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %19, i32 %20, i32 %21, i8* %23)
br label %45
25: ; preds = %5
%26 = load i8*, i8** %7
%27 = load i32, i32* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %26, i32 %27)
br label %45
29: ; preds = %5
%30 = load i8*, i8** %7
%31 = load i32, i32* %8
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %30, i32 %31)
br label %45
33: ; preds = %5
%34 = load i8*, i8** %7
%35 = load i32, i32* %8
%36 = load i32, i32* %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %34, i32 %35, i32 %36)
br label %45
38: ; preds = %5
%39 = load i8*, i8** %9
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %39)
%41 = load i32, i32* @stdout
%42 = call i32 @fflush(i32 %41)
br label %45
43: ; preds = %5
br label %45
44: ; preds = %5
br label %45
45: ; preds = %44, %43, %38, %33, %29, %25, %18, %13, %12
%46 = load i32, i32* @stdout
%47 = call i32 @fflush(i32 %46)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"Running %s #%d\0A\00"
@.str.2 = [22 x i8] c"%s(%d): Error %d: %s\0A\00"
@.str.3 = [17 x i8] c"%s(%d): Success\0A\00"
@.str.4 = [14 x i8] c"%s(%d): Skip\0A\00"
@.str.5 = [17 x i8] c"%s(%d): Fail %d\0A\00"
@.str.6 = [3 x i8] c"%s\00"
@stdout = global i32 0
@str = [33 x i8] c"********************************\00"
define i32 @cobaye_report_stdout(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
switch i32 %0, label %22 [
i32 8, label %18
i32 3, label %6
i32 5, label %9
i32 6, label %12
i32 4, label %14
i32 7, label %16
]
6: ; preds = %5
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
br label %22
9: ; preds = %5
%10 = tail call i8* @strerror(i32 %4)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %1, i32 %2, i32 %4, i8* %10)
br label %22
12: ; preds = %5
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %1, i32 %2)
br label %22
14: ; preds = %5
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %1, i32 %2)
br label %22
16: ; preds = %5
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %1, i32 %2, i32 %4)
br label %22
18: ; preds = %5
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%20 = load i32, i32* @stdout
%21 = tail call i32 @fflush(i32 %20)
br label %22
22: ; preds = %5, %18, %16, %14, %12, %9, %6
%23 = load i32, i32* @stdout
%24 = tail call i32 @fflush(i32 %23)
ret i32 0
}