#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*/);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ report(long);
long test_arith(int);
long test_array(int);
long test_bitop(int);
long test_cond(int);
long test_loops(int);
long test_types(int);
int main() {
  signed long result1 = 0;
  signed long result2 = 0;
  signed long result3 = 0;
  result1 = test_cond(1);
  result2 = test_cond(-1);
  result3 -= result1 + result2;
  report(result2);
  result1 = test_loops(1);
  result2 = test_loops(-1);
  result3 -= result1 + result2;
  report(result2);
  result1 = test_arith(1);
  result2 = test_arith(-1);
  result3 -= result1 + result2;
  report(result2);
  result1 = test_bitop(1);
  result2 = test_bitop(-1);
  result3 -= result1 + result2;
  report(result2);
  result1 = test_types(1);
  result2 = test_types(-1);
  result3 -= result1 + result2;
  report(result2);
  result1 = test_array(1);
  result2 = test_array(-1);
  result3 -= result1 + result2;
  report(result2);
  printf("RESULT: 0x%08lx\n", result3 ^ 0x4bad2569 ^ 0xdeaddead);
  report(result3 ^ 0x4bad2569 ^ 0xdeaddead);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x1,%edi
call   1050 <test_cond@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1050 <test_cond@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1070 <test_loops@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1070 <test_loops@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1060 <test_arith@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1060 <test_arith@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1080 <test_bitop@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1080 <test_bitop@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1030 <test_types@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1030 <test_types@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1090 <test_array@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1090 <test_array@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <report@plt>
mov    -0x20(%rbp),%rsi
xor    $0x4bad2569,%rsi
movabs $0xdeaddead,%rax
xor    %rax,%rsi
lea    0xcda(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
xor    $0x4bad2569,%rdi
movabs $0xdeaddead,%rax
xor    %rax,%rdi
call   10b0 <report@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
call   1050 <test_cond@plt>
mov    %rax,%r14
mov    $0xffffffff,%edi
call   1050 <test_cond@plt>
add    %rax,%r14
mov    %rax,%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1070 <test_loops@plt>
mov    %rax,%rbx
mov    $0xffffffff,%edi
call   1070 <test_loops@plt>
add    %rax,%rbx
add    %r14,%rbx
mov    %rax,%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1060 <test_arith@plt>
mov    %rax,%r14
mov    $0xffffffff,%edi
call   1060 <test_arith@plt>
add    %rax,%r14
add    %rbx,%r14
mov    %rax,%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1080 <test_bitop@plt>
mov    %rax,%rbx
mov    $0xffffffff,%edi
call   1080 <test_bitop@plt>
add    %rax,%rbx
add    %r14,%rbx
mov    %rax,%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1030 <test_types@plt>
mov    %rax,%r14
mov    $0xffffffff,%edi
call   1030 <test_types@plt>
add    %rax,%r14
add    %rbx,%r14
mov    %rax,%rdi
call   10b0 <report@plt>
mov    $0x1,%edi
call   1090 <test_array@plt>
mov    %rax,%rbx
mov    $0xffffffff,%edi
call   1090 <test_array@plt>
add    %rax,%rbx
add    %r14,%rbx
neg    %rbx
mov    %rax,%rdi
call   10b0 <report@plt>
mov    $0x9500fbc4,%r14d
xor    %rbx,%r14
lea    0xd7e(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %r14,%rdi
call   10b0 <report@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"RESULT: 0x%08lx\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
%5 = call i64 @test_cond(i32 1)
store i64 %5, i64* %2
%6 = call i64 @test_cond(i32 -1)
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = load i64, i64* %3
%9 = add nsw i64 %7, %8
%10 = load i64, i64* %4
%11 = sub nsw i64 %10, %9
store i64 %11, i64* %4
%12 = load i64, i64* %3
%13 = call i32 @report(i64 %12)
%14 = call i64 @test_loops(i32 1)
store i64 %14, i64* %2
%15 = call i64 @test_loops(i32 -1)
store i64 %15, i64* %3
%16 = load i64, i64* %2
%17 = load i64, i64* %3
%18 = add nsw i64 %16, %17
%19 = load i64, i64* %4
%20 = sub nsw i64 %19, %18
store i64 %20, i64* %4
%21 = load i64, i64* %3
%22 = call i32 @report(i64 %21)
%23 = call i64 @test_arith(i32 1)
store i64 %23, i64* %2
%24 = call i64 @test_arith(i32 -1)
store i64 %24, i64* %3
%25 = load i64, i64* %2
%26 = load i64, i64* %3
%27 = add nsw i64 %25, %26
%28 = load i64, i64* %4
%29 = sub nsw i64 %28, %27
store i64 %29, i64* %4
%30 = load i64, i64* %3
%31 = call i32 @report(i64 %30)
%32 = call i64 @test_bitop(i32 1)
store i64 %32, i64* %2
%33 = call i64 @test_bitop(i32 -1)
store i64 %33, i64* %3
%34 = load i64, i64* %2
%35 = load i64, i64* %3
%36 = add nsw i64 %34, %35
%37 = load i64, i64* %4
%38 = sub nsw i64 %37, %36
store i64 %38, i64* %4
%39 = load i64, i64* %3
%40 = call i32 @report(i64 %39)
%41 = call i64 @test_types(i32 1)
store i64 %41, i64* %2
%42 = call i64 @test_types(i32 -1)
store i64 %42, i64* %3
%43 = load i64, i64* %2
%44 = load i64, i64* %3
%45 = add nsw i64 %43, %44
%46 = load i64, i64* %4
%47 = sub nsw i64 %46, %45
store i64 %47, i64* %4
%48 = load i64, i64* %3
%49 = call i32 @report(i64 %48)
%50 = call i64 @test_array(i32 1)
store i64 %50, i64* %2
%51 = call i64 @test_array(i32 -1)
store i64 %51, i64* %3
%52 = load i64, i64* %2
%53 = load i64, i64* %3
%54 = add nsw i64 %52, %53
%55 = load i64, i64* %4
%56 = sub nsw i64 %55, %54
store i64 %56, i64* %4
%57 = load i64, i64* %3
%58 = call i32 @report(i64 %57)
%59 = load i64, i64* %4
%60 = xor i64 %59, 1269638505
%61 = xor i64 %60, 3735936685
%62 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %61)
%63 = load i64, i64* %4
%64 = xor i64 %63, 1269638505
%65 = xor i64 %64, 3735936685
%66 = call i32 @report(i64 %65)
%67 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"RESULT: 0x%08lx\0A\00"
define i32 @main() {
%1 = tail call i64 @test_cond(i32 1)
%2 = tail call i64 @test_cond(i32 -1)
%3 = add nsw i64 %1, %2
%4 = tail call i32 @report(i64 %2)
%5 = tail call i64 @test_loops(i32 1)
%6 = tail call i64 @test_loops(i32 -1)
%7 = add nsw i64 %5, %6
%8 = add i64 %3, %7
%9 = tail call i32 @report(i64 %6)
%10 = tail call i64 @test_arith(i32 1)
%11 = tail call i64 @test_arith(i32 -1)
%12 = add nsw i64 %10, %11
%13 = add i64 %8, %12
%14 = tail call i32 @report(i64 %11)
%15 = tail call i64 @test_bitop(i32 1)
%16 = tail call i64 @test_bitop(i32 -1)
%17 = add nsw i64 %15, %16
%18 = add i64 %13, %17
%19 = tail call i32 @report(i64 %16)
%20 = tail call i64 @test_types(i32 1)
%21 = tail call i64 @test_types(i32 -1)
%22 = add nsw i64 %20, %21
%23 = add i64 %18, %22
%24 = tail call i32 @report(i64 %21)
%25 = tail call i64 @test_array(i32 1)
%26 = tail call i64 @test_array(i32 -1)
%27 = add nsw i64 %25, %26
%28 = add i64 %23, %27
%29 = sub i64 0, %28
%30 = tail call i32 @report(i64 %26)
%31 = xor i64 %29, 2499869636
%32 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %31)
%33 = tail call i32 @report(i64 %31)
%34 = tail call i32 @exit(i32 0)
unreachable
}