#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 *, ...);
scalar_t__ test_convolve();
scalar_t__ test_decimate();
scalar_t__ test_ms_ssim();
scalar_t__ test_mse();
scalar_t__ test_psnr();
scalar_t__ test_ssim();
int main() {
  int failures = 0;
  printf("\n");
  failures += test_convolve();
  failures += test_decimate();
  failures += test_mse();
  failures += test_psnr();
  failures += test_ssim();
  failures += test_ms_ssim();
  if (failures)
    printf("\n\nRESULT: *** FAIL (%i) ***\n\n", failures);
  else
    printf("\n\nRESULT: Success\n\n");
  return failures;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <test_convolve@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1090 <test_decimate@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <test_mse@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <test_psnr@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_ssim@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_ms_ssim@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     122c <main+0xbc>
mov    -0x8(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123a <main+0xca>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <test_convolve@plt>
mov    %rax,%r14
xor    %eax,%eax
call   10b0 <test_decimate@plt>
mov    %rax,%r15
add    %r14d,%r15d
xor    %eax,%eax
call   1070 <test_mse@plt>
mov    %rax,%rbx
add    %r15d,%ebx
xor    %eax,%eax
call   10a0 <test_psnr@plt>
mov    %rax,%r14
add    %ebx,%r14d
xor    %eax,%eax
call   1080 <test_ssim@plt>
mov    %rax,%rbx
add    %r14d,%ebx
xor    %eax,%eax
call   1090 <test_ms_ssim@plt>
mov    %rax,%r14
add    %ebx,%r14d
je     11ff <main+0x6f>
lea    0xe0d(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    120b <main+0x7b>
lea    0xe18(%rip),%rdi
call   1050 <puts@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [30 x i8] c"\0A\0ARESULT: *** FAIL (%i) ***\0A\0A\00"
@.str.2 = [20 x i8] c"\0A\0ARESULT: Success\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i64 (...) @test_convolve()
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = add nsw i64 %6, %4
%8 = trunc i64 %7 to i32
store i32 %8, i32* %2
%9 = call i64 (...) @test_decimate()
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = add nsw i64 %11, %9
%13 = trunc i64 %12 to i32
store i32 %13, i32* %2
%14 = call i64 (...) @test_mse()
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = add nsw i64 %16, %14
%18 = trunc i64 %17 to i32
store i32 %18, i32* %2
%19 = call i64 (...) @test_psnr()
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = add nsw i64 %21, %19
%23 = trunc i64 %22 to i32
store i32 %23, i32* %2
%24 = call i64 (...) @test_ssim()
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = add nsw i64 %26, %24
%28 = trunc i64 %27 to i32
store i32 %28, i32* %2
%29 = call i64 (...) @test_ms_ssim()
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = add nsw i64 %31, %29
%33 = trunc i64 %32 to i32
store i32 %33, i32* %2
%34 = load i32, i32* %2
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %0
%37 = load i32, i32* %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %41
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"\0A\0ARESULT: *** FAIL (%i) ***\0A\0A\00"
@str = [19 x i8] c"\0A\0ARESULT: Success\0A\00"
define i32 @main() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i64 (...) @test_convolve()
%3 = tail call i64 (...) @test_decimate()
%4 = add i64 %3, %2
%5 = tail call i64 (...) @test_mse()
%6 = add i64 %4, %5
%7 = tail call i64 (...) @test_psnr()
%8 = add i64 %6, %7
%9 = tail call i64 (...) @test_ssim()
%10 = add i64 %8, %9
%11 = tail call i64 (...) @test_ms_ssim()
%12 = add i64 %10, %11
%13 = trunc i64 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %0
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %19
17: ; preds = %0
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
ret i32 %13
}