#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*/ check_offloading();
int /*<<< orphan*/ printf(char *, int);
scalar_t__ test_aligned();
scalar_t__ test_collapsed();
scalar_t__ test_linear();
scalar_t__ test_private();
scalar_t__ test_safelen();
int main() {
  int error = 0;
  check_offloading();
  error += test_aligned();
  error += test_collapsed();
  error += test_linear();
  error += test_private();
  error += test_safelen();
  printf("done with %d errors\n", error);
  return error;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1060 <check_offloading@plt>
mov    $0x0,%al
call   1040 <test_aligned@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_collapsed@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <test_linear@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <test_private@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1090 <test_safelen@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe05(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <check_offloading@plt>
xor    %eax,%eax
call   1040 <test_aligned@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1070 <test_collapsed@plt>
mov    %rax,%r15
add    %r14d,%r15d
xor    %eax,%eax
call   1080 <test_linear@plt>
mov    %rax,%rbx
add    %r15d,%ebx
xor    %eax,%eax
call   1050 <test_private@plt>
mov    %rax,%r14
add    %ebx,%r14d
xor    %eax,%eax
call   1090 <test_safelen@plt>
mov    %rax,%rbx
add    %r14d,%ebx
lea    0xe3f(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"done with %d errors\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @check_offloading()
%4 = call i64 (...) @test_aligned()
%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_collapsed()
%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_linear()
%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_private()
%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_safelen()
%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 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [21 x i8] c"done with %d errors\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @check_offloading()
%2 = tail call i64 (...) @test_aligned()
%3 = tail call i64 (...) @test_collapsed()
%4 = add i64 %3, %2
%5 = tail call i64 (...) @test_linear()
%6 = add i64 %4, %5
%7 = tail call i64 (...) @test_private()
%8 = add i64 %6, %7
%9 = tail call i64 (...) @test_safelen()
%10 = add i64 %8, %9
%11 = trunc i64 %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 %11
}