#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_q84add(int, int);
int /*<<< orphan*/ printf(char *, ...);
int prog_q84add(int, int);
int rand();
int Q8_4_ADD_AUTOTEST() {
  printf("LAUNCHING THE (Q8_4_SUB) RESOURCE AUTOTEST...\n");
  int i, j;
  for (j = 0; j < 10; j++) {
    int op1 = (rand() % 256) - 128;
    int op2 = (rand() % 256) - 128;
    int op3 = instr_q84add(op1, op2);
    int op4 = prog_q84add(op1, op2);
    if (op3 != op4) {
      printf("- TEST OF THE (Q8_4_ADD) RESOURCE => FAILED !\n");
      printf("  + %d COMPUTATION(s) BEFORE ERROR...\n", j);
      printf("  + OPERANDE 1 [%d]\n", op1);
      printf("  + OPERANDE 2 [%d]\n", op2);
      printf("  + ASM INSTR. [%d]\n", op3);
      printf("  + REF C CODE [%d]\n", op4);
      return 0;
    }
  }
  printf("- TEST OF THE (Q8_4_ADD) RESOURCE => OK\n");
  return 1;
}


x86 assembly (clang, -O0):
<Q8_4_ADD_AUTOTEST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1241 <Q8_4_ADD_AUTOTEST+0x101>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
sub    $0x80,%edx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
sub    $0x80,%edx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <instr_q84add@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <prog_q84add@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     122e <Q8_4_ADD_AUTOTEST+0xee>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1256 <Q8_4_ADD_AUTOTEST+0x116>
jmp    1233 <Q8_4_ADD_AUTOTEST+0xf3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <Q8_4_ADD_AUTOTEST+0x1d>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q8_4_ADD_AUTOTEST>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r12d
add    $0xffffff80,%r12d
xor    %eax,%eax
call   1070 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xffffff80,%ebp
mov    %r12d,%edi
mov    %ebp,%esi
call   1050 <instr_q84add@plt>
mov    %eax,%r15d
mov    %r12d,%edi
mov    %ebp,%esi
call   1060 <prog_q84add@plt>
cmp    %eax,%r15d
jne    11ea <Q8_4_ADD_AUTOTEST+0x9a>
add    $0x1,%ebx
cmp    $0xa,%ebx
jne    1170 <Q8_4_ADD_AUTOTEST+0x20>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r13d
jmp    124f <Q8_4_ADD_AUTOTEST+0xff>
mov    %eax,%r14d
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe00(%rip),%rdi
xor    %r13d,%r13d
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe21(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"LAUNCHING THE (Q8_4_SUB) RESOURCE AUTOTEST...\0A\00"
@.str.1 = [47 x i8] c"- TEST OF THE (Q8_4_ADD) 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" + OPERANDE 2 [%d]\0A\00"
@.str.5 = [21 x i8] c" + ASM INSTR. [%d]\0A\00"
@.str.6 = [21 x i8] c" + REF C CODE [%d]\0A\00"
@.str.7 = [41 x i8] c"- TEST OF THE (Q8_4_ADD) RESOURCE => OK\0A\00"
define i32 @Q8_4_ADD_AUTOTEST() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %9
9: ; preds = %41, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %44
12: ; preds = %9
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 256
%15 = sub nsw i32 %14, 128
store i32 %15, i32* %4
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 256
%18 = sub nsw i32 %17, 128
store i32 %18, i32* %5
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i32 @instr_q84add(i32 %19, i32 %20)
store i32 %21, i32* %6
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @prog_q84add(i32 %22, i32 %23)
store i32 %24, i32* %7
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = icmp ne i32 %25, %26
br i1 %27, label %28, label %40
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %5
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %7
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %38)
store i32 0, i32* %1
br label %46
40: ; preds = %12
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %9
44: ; preds = %9
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %46
46: ; preds = %44, %28
%47 = load i32, i32* %1
ret i32 %47
}

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" + OPERANDE 2 [%d]\0A\00"
@.str.5 = [21 x i8] c" + ASM INSTR. [%d]\0A\00"
@.str.6 = [21 x i8] c" + REF C CODE [%d]\0A\00"
@str = [46 x i8] c"LAUNCHING THE (Q8_4_SUB) RESOURCE AUTOTEST...\00"
@str.8 = [40 x i8] c"- TEST OF THE (Q8_4_ADD) RESOURCE => OK\00"
@str.9 = [46 x i8] c"- TEST OF THE (Q8_4_ADD) RESOURCE => FAILED !\00"
define i32 @Q8_4_ADD_AUTOTEST() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %20
%3 = phi i32 [ 0, %0 ], [ %21, %20 ]
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 256
%6 = add nsw i32 %5, -128
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 256
%9 = add nsw i32 %8, -128
%10 = tail call i32 @instr_q84add(i32 %6, i32 %9)
%11 = tail call i32 @prog_q84add(i32 %6, i32 %9)
%12 = icmp eq i32 %10, %11
br i1 %12, label %20, label %13
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %11)
br label %25
20: ; preds = %2
%21 = add nuw nsw i32 %3, 1
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %2
23: ; preds = %20
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.8, i64 0, i64 0))
br label %25
25: ; preds = %13, %23
%26 = phi i32 [ 0, %13 ], [ 1, %23 ]
ret i32 %26
}