#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*/ printf(char *, char const *, ...);
int /*<<< orphan*/ puts(char const *);
void run_if(bool condition, const char *message, void (*function)(void)) {
  if (condition == true) {
    puts("===========================================");
    puts(message);
    printf("%50s  %30s %30s %10s \n", "FUNCTION", "SCENARIO", "EXPECTED_RESULT",
           "STATUS");
    function();
    printf("\n%s finished with success\n", message);
    puts("===========================================");
  }
}


x86 assembly (clang, -O0):
<run_if>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    119d <run_if+0x7d>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
lea    0xee3(%rip),%rsi
lea    0xee5(%rip),%rdx
lea    0xee7(%rip),%rcx
lea    0xef0(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
call   *-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_if>:
cmp    $0x1,%edi
jne    1192 <run_if+0x72>
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%rbx
lea    0xec9(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xede(%rip),%rdi
lea    0xeee(%rip),%rsi
lea    0xef0(%rip),%rdx
lea    0xef2(%rip),%rcx
lea    0xefb(%rip),%r8
xor    %eax,%eax
call   1040 <printf@plt>
call   *%r15
lea    0xef1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>
ret

LLVM IR (-O0):
@.str = [44 x i8] c"===========================================\00"
@.str.1 = [23 x i8] c"%50s %30s %30s %10s \0A\00"
@.str.2 = [9 x i8] c"FUNCTION\00"
@.str.3 = [9 x i8] c"SCENARIO\00"
@.str.4 = [16 x i8] c"EXPECTED_RESULT\00"
@.str.5 = [7 x i8] c"STATUS\00"
@.str.6 = [27 x i8] c"\0A%s finished with success\0A\00"
define void @run_if(i32 %0, i8* %1, void ()* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca void ()*
store i32 %0, i32* %4
store i8* %1, i8** %5
store void ()* %2, void ()** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %18
9: ; preds = %3
%10 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %5
%12 = call i32 @puts(i8* %11)
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%14 = load void ()*, void ()** %6
%15 = load i8*, i8** %5
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%17 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"===========================================\00"
@.str.1 = [23 x i8] c"%50s %30s %30s %10s \0A\00"
@.str.2 = [9 x i8] c"FUNCTION\00"
@.str.3 = [9 x i8] c"SCENARIO\00"
@.str.4 = [16 x i8] c"EXPECTED_RESULT\00"
@.str.5 = [7 x i8] c"STATUS\00"
@.str.6 = [27 x i8] c"\0A%s finished with success\0A\00"
define void @run_if(i32 %0, i8* %1, void ()* nocapture %2) {
%4 = icmp eq i32 %0, 1
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) %1)
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
tail call void %2()
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %5, %3
ret void
}