#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 instr_q168abs(int);
int /*<<< orphan*/ printf(char *, ...);
int prog_q168abs(int);
int rand();
int Q16_8_ABS_AUTOTEST() {
  printf("LAUNCHING THE (Q16_8_ABS) RESOURCE AUTOTEST...\n");
  int i, j;
  for (j = 0; j < 10; j++) {
    int op1 = (rand() % 65536) - 32768;
    int op3 = instr_q168abs(op1);
    int op4 = prog_q168abs(op1);
    if (op3 != op4) {
      printf("- TEST OF THE (Q16_8_ABS) RESOURCE => FAILED !\n");
      printf("  + %d COMPUTATION(s) BEFORE ERROR...\n", j);
      printf("  + OPERANDE 1 [%d]\n", op1);
      printf("  + ASM INSTR. [%d]\n", op3);
      printf("  + REF C CODE [%d]\n", op4);
      return 0;
    }
  }
  printf("- TEST OF THE (Q16_8_ABS) RESOURCE => OK\n");
  return 1;
}


x86 assembly (clang, -O0):
<Q16_8_ABS_AUTOTEST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1212 <Q16_8_ABS_AUTOTEST+0xd2>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
sub    $0x8000,%edx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <instr_q168abs@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <prog_q168abs@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     11ff <Q16_8_ABS_AUTOTEST+0xbf>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1227 <Q16_8_ABS_AUTOTEST+0xe7>
jmp    1204 <Q16_8_ABS_AUTOTEST+0xc4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <Q16_8_ABS_AUTOTEST+0x1d>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q16_8_ABS_AUTOTEST>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    13dc <Q16_8_ABS_AUTOTEST+0x28c>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    13e3 <Q16_8_ABS_AUTOTEST+0x293>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    13ed <Q16_8_ABS_AUTOTEST+0x29d>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    13f7 <Q16_8_ABS_AUTOTEST+0x2a7>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    1401 <Q16_8_ABS_AUTOTEST+0x2b1>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    140b <Q16_8_ABS_AUTOTEST+0x2bb>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    1415 <Q16_8_ABS_AUTOTEST+0x2c5>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    141f <Q16_8_ABS_AUTOTEST+0x2cf>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    1429 <Q16_8_ABS_AUTOTEST+0x2d9>
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffff8000,%ebp
mov    %ebp,%edi
call   1060 <instr_q168abs@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <prog_q168abs@plt>
cmp    %eax,%r15d
jne    1433 <Q16_8_ABS_AUTOTEST+0x2e3>
lea    0xcc9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
jmp    1489 <Q16_8_ABS_AUTOTEST+0x339>
mov    %eax,%ebx
xor    %r12d,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x1,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x2,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x3,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x4,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x5,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x6,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x7,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x8,%r12d
jmp    143b <Q16_8_ABS_AUTOTEST+0x2eb>
mov    %eax,%ebx
mov    $0x9,%r12d
lea    0xc7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xbb2(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbc8(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbcd(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbd1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"LAUNCHING THE (Q16_8_ABS) RESOURCE AUTOTEST...\0A\00"
@.str.1 = [48 x i8] c"- TEST OF THE (Q16_8_ABS) RESOURCE => FAILED !\0A\00"
@.str.2 = [39 x i8] c" + %d COMPUTATION(s) BEFORE ERROR...\0A\00"
@.str.3 = [21 x i8] c" + OPERANDE 1 [%d]\0A\00"
@.str.4 = [21 x i8] c" + ASM INSTR. [%d]\0A\00"
@.str.5 = [21 x i8] c" + REF C CODE [%d]\0A\00"
@.str.6 = [42 x i8] c"- TEST OF THE (Q16_8_ABS) RESOURCE => OK\0A\00"
define i32 @Q16_8_ABS_AUTOTEST() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %33, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %36
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 65536
%14 = sub nsw i32 %13, 32768
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = call i32 @instr_q168abs(i32 %15)
store i32 %16, i32* %5
%17 = load i32, i32* %4
%18 = call i32 @prog_q168abs(i32 %17)
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %11
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %5
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %30)
store i32 0, i32* %1
br label %38
32: ; preds = %11
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %8
36: ; preds = %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %1
br label %38
38: ; preds = %36, %22
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str.2 = [39 x i8] c" + %d COMPUTATION(s) BEFORE ERROR...\0A\00"
@.str.3 = [21 x i8] c" + OPERANDE 1 [%d]\0A\00"
@.str.4 = [21 x i8] c" + ASM INSTR. [%d]\0A\00"
@.str.5 = [21 x i8] c" + REF C CODE [%d]\0A\00"
@str = [47 x i8] c"LAUNCHING THE (Q16_8_ABS) RESOURCE AUTOTEST...\00"
@str.7 = [41 x i8] c"- TEST OF THE (Q16_8_ABS) RESOURCE => OK\00"
@str.8 = [47 x i8] c"- TEST OF THE (Q16_8_ABS) RESOURCE => FAILED !\00"
define i32 @Q16_8_ABS_AUTOTEST() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 65536
%4 = add nsw i32 %3, -32768
%5 = tail call i32 @instr_q168abs(i32 %4)
%6 = tail call i32 @prog_q168abs(i32 %4)
%7 = icmp eq i32 %5, %6
br i1 %7, label %18, label %8
8: ; preds = %74, %67, %60, %53, %46, %39, %32, %25, %18, %0
%9 = phi i32 [ 0, %0 ], [ 1, %18 ], [ 2, %25 ], [ 3, %32 ], [ 4, %39 ], [ 5, %46 ], [ 6, %53 ], [ 7, %60 ], [ 8, %67 ], [ 9, %74 ]
%10 = phi i32 [ %4, %0 ], [ %21, %18 ], [ %28, %25 ], [ %35, %32 ], [ %42, %39 ], [ %49, %46 ], [ %56, %53 ], [ %63, %60 ], [ %70, %67 ], [ %77, %74 ]
%11 = phi i32 [ %5, %0 ], [ %22, %18 ], [ %29, %25 ], [ %36, %32 ], [ %43, %39 ], [ %50, %46 ], [ %57, %53 ], [ %64, %60 ], [ %71, %67 ], [ %78, %74 ]
%12 = phi i32 [ %6, %0 ], [ %23, %18 ], [ %30, %25 ], [ %37, %32 ], [ %44, %39 ], [ %51, %46 ], [ %58, %53 ], [ %65, %60 ], [ %72, %67 ], [ %79, %74 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.8, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %12)
br label %83
18: ; preds = %0
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 65536
%21 = add nsw i32 %20, -32768
%22 = tail call i32 @instr_q168abs(i32 %21)
%23 = tail call i32 @prog_q168abs(i32 %21)
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %8
25: ; preds = %18
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, 65536
%28 = add nsw i32 %27, -32768
%29 = tail call i32 @instr_q168abs(i32 %28)
%30 = tail call i32 @prog_q168abs(i32 %28)
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %8
32: ; preds = %25
%33 = tail call i32 (...) @rand()
%34 = srem i32 %33, 65536
%35 = add nsw i32 %34, -32768
%36 = tail call i32 @instr_q168abs(i32 %35)
%37 = tail call i32 @prog_q168abs(i32 %35)
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %8
39: ; preds = %32
%40 = tail call i32 (...) @rand()
%41 = srem i32 %40, 65536
%42 = add nsw i32 %41, -32768
%43 = tail call i32 @instr_q168abs(i32 %42)
%44 = tail call i32 @prog_q168abs(i32 %42)
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %8
46: ; preds = %39
%47 = tail call i32 (...) @rand()
%48 = srem i32 %47, 65536
%49 = add nsw i32 %48, -32768
%50 = tail call i32 @instr_q168abs(i32 %49)
%51 = tail call i32 @prog_q168abs(i32 %49)
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %8
53: ; preds = %46
%54 = tail call i32 (...) @rand()
%55 = srem i32 %54, 65536
%56 = add nsw i32 %55, -32768
%57 = tail call i32 @instr_q168abs(i32 %56)
%58 = tail call i32 @prog_q168abs(i32 %56)
%59 = icmp eq i32 %57, %58
br i1 %59, label %60, label %8
60: ; preds = %53
%61 = tail call i32 (...) @rand()
%62 = srem i32 %61, 65536
%63 = add nsw i32 %62, -32768
%64 = tail call i32 @instr_q168abs(i32 %63)
%65 = tail call i32 @prog_q168abs(i32 %63)
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %8
67: ; preds = %60
%68 = tail call i32 (...) @rand()
%69 = srem i32 %68, 65536
%70 = add nsw i32 %69, -32768
%71 = tail call i32 @instr_q168abs(i32 %70)
%72 = tail call i32 @prog_q168abs(i32 %70)
%73 = icmp eq i32 %71, %72
br i1 %73, label %74, label %8
74: ; preds = %67
%75 = tail call i32 (...) @rand()
%76 = srem i32 %75, 65536
%77 = add nsw i32 %76, -32768
%78 = tail call i32 @instr_q168abs(i32 %77)
%79 = tail call i32 @prog_q168abs(i32 %77)
%80 = icmp eq i32 %78, %79
br i1 %80, label %81, label %8
81: ; preds = %74
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.7, i64 0, i64 0))
br label %83
83: ; preds = %8, %81
%84 = phi i32 [ 0, %8 ], [ 1, %81 ]
ret i32 %84
}