#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_stop(int);
int /*<<< orphan*/ printf(char *, ...);
int prog_stop(int);
int rand();
int STOP_32b_AUTOTEST() {
  int i, j;
  printf("LAUNCHING THE (STOP) RESOURCE TEST...\n");
  for (j = 0; j < 10; j++) {
    int op1 = rand() % 65536;
    int res1 = instr_stop(op1);
    int res2 = prog_stop(op1);
    if (res1 != res2) {
      printf("- TEST OF THE (STOP) RESOURCE => FAILED !\n");
      printf("  + %d COMPUTATION BEFORE ERROR... !\n", j);
      printf("  + INSTRUCTION RESULT (%d) => %d\n", op1, res1);
      printf("  + C CODE RESULT      (%d) => %d\n", op1, res2);
      return 0;
    }
  }
  printf("- TEST OF THE (STOP) RESOURCE => OK\n");
  return 1;
}


x86 assembly (clang, -O0):
<STOP_32b_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    1201 <STOP_32b_AUTOTEST+0xc1>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <instr_stop@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <prog_stop@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     11ee <STOP_32b_AUTOTEST+0xae>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1216 <STOP_32b_AUTOTEST+0xd6>
jmp    11f3 <STOP_32b_AUTOTEST+0xb3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <STOP_32b_AUTOTEST+0x1d>
lea    0xeb6(%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):
<STOP_32b_AUTOTEST>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xf0d(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    138c <STOP_32b_AUTOTEST+0x23c>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    1393 <STOP_32b_AUTOTEST+0x243>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    139d <STOP_32b_AUTOTEST+0x24d>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13a7 <STOP_32b_AUTOTEST+0x257>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13b1 <STOP_32b_AUTOTEST+0x261>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13bb <STOP_32b_AUTOTEST+0x26b>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13c5 <STOP_32b_AUTOTEST+0x275>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13cf <STOP_32b_AUTOTEST+0x27f>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13d9 <STOP_32b_AUTOTEST+0x289>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0xffff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffff0000,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1060 <instr_stop@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1030 <prog_stop@plt>
cmp    %eax,%r15d
jne    13e3 <STOP_32b_AUTOTEST+0x293>
lea    0xd16(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r14d
jmp    142d <STOP_32b_AUTOTEST+0x2dd>
mov    %eax,%ebp
xor    %r12d,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x1,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x2,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x3,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x4,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x5,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x6,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x7,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x8,%r12d
jmp    13eb <STOP_32b_AUTOTEST+0x29b>
mov    %eax,%ebp
mov    $0x9,%r12d
lea    0xcc4(%rip),%rdi
call   1040 <puts@plt>
lea    0xc02(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc17(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc27(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
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 = [39 x i8] c"LAUNCHING THE (STOP) RESOURCE TEST...\0A\00"
@.str.1 = [43 x i8] c"- TEST OF THE (STOP) RESOURCE => FAILED !\0A\00"
@.str.2 = [38 x i8] c" + %d COMPUTATION BEFORE ERROR... !\0A\00"
@.str.3 = [35 x i8] c" + INSTRUCTION RESULT (%d) => %d\0A\00"
@.str.4 = [35 x i8] c" + C CODE RESULT (%d) => %d\0A\00"
@.str.5 = [37 x i8] c"- TEST OF THE (STOP) RESOURCE => OK\0A\00"
define i32 @STOP_32b_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 ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %32, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %35
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 65536
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = call i32 @instr_stop(i32 %14)
store i32 %15, i32* %5
%16 = load i32, i32* %4
%17 = call i32 @prog_stop(i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %31
21: ; preds = %11
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %25, i32 %26)
%28 = load i32, i32* %4
%29 = load i32, i32* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %29)
store i32 0, i32* %1
br label %37
31: ; preds = %11
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %8
35: ; preds = %8
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %1
br label %37
37: ; preds = %35, %21
%38 = load i32, i32* %1
ret i32 %38
}

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