#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_v8mix(int, int);
int /*<<< orphan*/ printf(char *, ...);
int prog_v8mix(int, int);
int rand();
int MMX_MIX_8b_AUTOTEST() {
  int i, j;
  printf("LAUNCHING THE (MMX_MIX) RESOURCE AUTOTEST...\n");
  for (j = 0; j < 10; j++) {
    int op1 = ((rand() % 65536) << 16) & (rand() % 65536);
    int op2 = ((rand() % 4 + 1) << 24) & ((rand() % 4 + 1) << 16) &
              ((rand() % 4 + 1) << 8) & ((rand() % 4 + 1) << 0);
    int op3 = instr_v8mix(op1, op2);
    int op4 = prog_v8mix(op1, op2);
    if (op3 != op4) {
      printf("- TEST OF THE (MMX_MIX) RESOURCE => FAILED !\n");
      printf("  + %d COMPUTATION(s) BEFORE ERROR...\n", j);
      printf("  + OPERANDE 1 [%.3d %.3d %.3d %.3d]\n",
             ((op1 & 0xFF000000) >> 24), ((op1 & 0x00FF0000) >> 16),
             ((op1 & 0x0000FF00) >> 8), ((op1 & 0x000000FF)));
      printf("  + OPERANDE 2 [%.3d %.3d %.3d %.3d]\n",
             ((op2 & 0xFF000000) >> 24), ((op2 & 0x00FF0000) >> 16),
             ((op2 & 0x0000FF00) >> 8), ((op2 & 0x000000FF)));
      printf("  + ASM INSTR. [%.3d %.3d %.3d %.3d]\n",
             ((op3 & 0xFF000000) >> 24), ((op3 & 0x00FF0000) >> 16),
             ((op3 & 0x0000FF00) >> 8), ((op3 & 0x000000FF)));
      printf("  + REF C CODE [%.3d %.3d %.3d %.3d]\n",
             ((op4 & 0xFF000000) >> 24), ((op4 & 0x00FF0000) >> 16),
             ((op4 & 0x0000FF00) >> 8), ((op4 & 0x000000FF)));
      return 0;
    }
  }
  printf("- TEST OF THE (MMX_MIX) RESOURCE => OK\n");
  return 1;
}


x86 assembly (clang, -O0):
<MMX_MIX_8b_AUTOTEST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1364 <MMX_MIX_8b_AUTOTEST+0x224>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
shl    $0x10,%edx
mov    %edx,-0x2c(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    -0x2c(%rbp),%eax
and    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
shl    $0x18,%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%eax
mov    %edx,%ecx
add    $0x1,%ecx
shl    $0x10,%ecx
and    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x24(%rbp),%eax
mov    %edx,%ecx
add    $0x1,%ecx
shl    $0x8,%ecx
and    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
mov    %edx,%ecx
add    $0x1,%ecx
shl    $0x0,%ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <instr_v8mix@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <prog_v8mix@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1351 <MMX_MIX_8b_AUTOTEST+0x211>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
and    $0xff000000,%esi
shr    $0x18,%esi
mov    -0x10(%rbp),%edx
and    $0xff0000,%edx
sar    $0x10,%edx
mov    -0x10(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%r8d
and    $0xff,%r8d
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
and    $0xff000000,%esi
shr    $0x18,%esi
mov    -0x14(%rbp),%edx
and    $0xff0000,%edx
sar    $0x10,%edx
mov    -0x14(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x14(%rbp),%r8d
and    $0xff,%r8d
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
and    $0xff000000,%esi
shr    $0x18,%esi
mov    -0x18(%rbp),%edx
and    $0xff0000,%edx
sar    $0x10,%edx
mov    -0x18(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x18(%rbp),%r8d
and    $0xff,%r8d
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
and    $0xff000000,%esi
shr    $0x18,%esi
mov    -0x1c(%rbp),%edx
and    $0xff0000,%edx
sar    $0x10,%edx
mov    -0x1c(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x1c(%rbp),%r8d
and    $0xff,%r8d
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1379 <MMX_MIX_8b_AUTOTEST+0x239>
jmp    1356 <MMX_MIX_8b_AUTOTEST+0x216>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <MMX_MIX_8b_AUTOTEST+0x1d>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_MIX_8b_AUTOTEST>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf5d(%rip),%rdi
call   1030 <puts@plt>
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%r12d
lea    0xffff(%r12),%eax
test   %r12d,%r12d
cmovns %r12d,%eax
and    $0xffff0000,%eax
sub    %eax,%r12d
and    %ebx,%r12d
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebp
lea    0x3(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xfc,%eax
sub    %eax,%ebp
shl    $0x18,%ebp
add    $0x1000000,%ebp
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%r14d
lea    0x3(%r14),%eax
test   %r14d,%r14d
cmovns %r14d,%eax
and    $0xfffc,%eax
sub    %eax,%r14d
shl    $0x10,%r14d
add    $0x10000,%r14d
and    %ebp,%r14d
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffc,%eax
sub    %eax,%ebx
shl    $0x8,%ebx
add    $0x100,%ebx
xor    %eax,%eax
call   1070 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
and    %ebx,%ebp
and    %r14d,%ebp
mov    %r12d,%edi
mov    %ebp,%esi
call   1050 <instr_v8mix@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %ebp,%esi
call   1060 <prog_v8mix@plt>
cmp    %eax,%ebx
jne    126b <MMX_MIX_8b_AUTOTEST+0x11b>
add    $0x1,%r15d
cmp    $0xa,%r15d
jne    1170 <MMX_MIX_8b_AUTOTEST+0x20>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
jmp    131a <MMX_MIX_8b_AUTOTEST+0x1ca>
mov    %ebx,%r13d
lea    0xe9e(%rip),%rdi
mov    %eax,0x4(%rsp)
call   1030 <puts@plt>
lea    0xd7b(%rip),%rdi
xor    %r14d,%r14d
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12d,%esi
shr    $0x18,%esi
shr    $0x10,%r12d
movzbl %r12b,%edx
lea    0xd80(%rip),%rdi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
shr    $0x18,%ebp
lea    0xd90(%rip),%rdi
mov    %ebp,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
shr    $0x18,%ebx
mov    %r13d,%ecx
shr    $0x10,%ecx
movzbl %cl,%edx
movzbl %ah,%ecx
movzbl %al,%r8d
lea    0xd8a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%eax
shr    $0x18,%eax
mov    %ebx,%ecx
shr    $0x10,%ecx
movzbl %cl,%edx
movzbl %bh,%ecx
movzbl %bl,%r8d
lea    0xd88(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"LAUNCHING THE (MMX_MIX) RESOURCE AUTOTEST...\0A\00"
@.str.1 = [46 x i8] c"- TEST OF THE (MMX_MIX) RESOURCE => FAILED !\0A\00"
@.str.2 = [39 x i8] c" + %d COMPUTATION(s) BEFORE ERROR...\0A\00"
@.str.3 = [38 x i8] c" + OPERANDE 1 [%.3d %.3d %.3d %.3d]\0A\00"
@.str.4 = [38 x i8] c" + OPERANDE 2 [%.3d %.3d %.3d %.3d]\0A\00"
@.str.5 = [38 x i8] c" + ASM INSTR. [%.3d %.3d %.3d %.3d]\0A\00"
@.str.6 = [38 x i8] c" + REF C CODE [%.3d %.3d %.3d %.3d]\0A\00"
@.str.7 = [40 x i8] c"- TEST OF THE (MMX_MIX) RESOURCE => OK\0A\00"
define i32 @MMX_MIX_8b_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 ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %9
9: ; preds = %100, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %103
12: ; preds = %9
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 65536
%15 = shl i32 %14, 16
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 65536
%18 = and i32 %15, %17
store i32 %18, i32* %4
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 4
%21 = add nsw i32 %20, 1
%22 = shl i32 %21, 24
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 4
%25 = add nsw i32 %24, 1
%26 = shl i32 %25, 16
%27 = and i32 %22, %26
%28 = call i32 (...) @rand()
%29 = srem i32 %28, 4
%30 = add nsw i32 %29, 1
%31 = shl i32 %30, 8
%32 = and i32 %27, %31
%33 = call i32 (...) @rand()
%34 = srem i32 %33, 4
%35 = add nsw i32 %34, 1
%36 = shl i32 %35, 0
%37 = and i32 %32, %36
store i32 %37, i32* %5
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = call i32 @instr_v8mix(i32 %38, i32 %39)
store i32 %40, i32* %6
%41 = load i32, i32* %4
%42 = load i32, i32* %5
%43 = call i32 @prog_v8mix(i32 %41, i32 %42)
store i32 %43, i32* %7
%44 = load i32, i32* %6
%45 = load i32, i32* %7
%46 = icmp ne i32 %44, %45
br i1 %46, label %47, label %99
47: ; preds = %12
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%49 = load i32, i32* %3
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %4
%52 = and i32 %51, -16777216
%53 = lshr i32 %52, 24
%54 = load i32, i32* %4
%55 = and i32 %54, 16711680
%56 = ashr i32 %55, 16
%57 = load i32, i32* %4
%58 = and i32 %57, 65280
%59 = ashr i32 %58, 8
%60 = load i32, i32* %4
%61 = and i32 %60, 255
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %53, i32 %56, i32 %59, i32 %61)
%63 = load i32, i32* %5
%64 = and i32 %63, -16777216
%65 = lshr i32 %64, 24
%66 = load i32, i32* %5
%67 = and i32 %66, 16711680
%68 = ashr i32 %67, 16
%69 = load i32, i32* %5
%70 = and i32 %69, 65280
%71 = ashr i32 %70, 8
%72 = load i32, i32* %5
%73 = and i32 %72, 255
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %65, i32 %68, i32 %71, i32 %73)
%75 = load i32, i32* %6
%76 = and i32 %75, -16777216
%77 = lshr i32 %76, 24
%78 = load i32, i32* %6
%79 = and i32 %78, 16711680
%80 = ashr i32 %79, 16
%81 = load i32, i32* %6
%82 = and i32 %81, 65280
%83 = ashr i32 %82, 8
%84 = load i32, i32* %6
%85 = and i32 %84, 255
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %77, i32 %80, i32 %83, i32 %85)
%87 = load i32, i32* %7
%88 = and i32 %87, -16777216
%89 = lshr i32 %88, 24
%90 = load i32, i32* %7
%91 = and i32 %90, 16711680
%92 = ashr i32 %91, 16
%93 = load i32, i32* %7
%94 = and i32 %93, 65280
%95 = ashr i32 %94, 8
%96 = load i32, i32* %7
%97 = and i32 %96, 255
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %89, i32 %92, i32 %95, i32 %97)
store i32 0, i32* %1
br label %105
99: ; preds = %12
br label %100
100: ; preds = %99
%101 = load i32, i32* %3
%102 = add nsw i32 %101, 1
store i32 %102, i32* %3
br label %9
103: ; preds = %9
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %105
105: ; preds = %103, %47
%106 = load i32, i32* %1
ret i32 %106
}

LLVM IR (-O2):
@.str.2 = [39 x i8] c" + %d COMPUTATION(s) BEFORE ERROR...\0A\00"
@.str.3 = [38 x i8] c" + OPERANDE 1 [%.3d %.3d %.3d %.3d]\0A\00"
@.str.4 = [38 x i8] c" + OPERANDE 2 [%.3d %.3d %.3d %.3d]\0A\00"
@.str.5 = [38 x i8] c" + ASM INSTR. [%.3d %.3d %.3d %.3d]\0A\00"
@.str.6 = [38 x i8] c" + REF C CODE [%.3d %.3d %.3d %.3d]\0A\00"
@str = [45 x i8] c"LAUNCHING THE (MMX_MIX) RESOURCE AUTOTEST...\00"
@str.8 = [39 x i8] c"- TEST OF THE (MMX_MIX) RESOURCE => OK\00"
@str.9 = [45 x i8] c"- TEST OF THE (MMX_MIX) RESOURCE => FAILED !\00"
define i32 @MMX_MIX_8b_AUTOTEST() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %53
%3 = phi i32 [ 0, %0 ], [ %54, %53 ]
%4 = tail call i32 (...) @rand()
%5 = shl i32 %4, 16
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 65536
%8 = and i32 %7, %5
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 4
%11 = shl nsw i32 %10, 24
%12 = add nsw i32 %11, 16777216
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 4
%15 = shl nsw i32 %14, 16
%16 = add nsw i32 %15, 65536
%17 = and i32 %16, %12
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, 4
%20 = shl nsw i32 %19, 8
%21 = add nsw i32 %20, 256
%22 = and i32 %17, %21
%23 = tail call i32 (...) @rand()
%24 = srem i32 %23, 4
%25 = add nsw i32 %24, 1
%26 = and i32 %22, %25
%27 = tail call i32 @instr_v8mix(i32 %8, i32 %26)
%28 = tail call i32 @prog_v8mix(i32 %8, i32 %26)
%29 = icmp eq i32 %27, %28
br i1 %29, label %53, label %30
30: ; preds = %2
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.9, i64 0, i64 0))
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%33 = lshr i32 %8, 24
%34 = lshr exact i32 %8, 16
%35 = and i32 %34, 255
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 %35, i32 0, i32 0)
%37 = lshr exact i32 %26, 24
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %37, i32 0, i32 0, i32 0)
%39 = lshr i32 %27, 24
%40 = lshr i32 %27, 16
%41 = and i32 %40, 255
%42 = lshr i32 %27, 8
%43 = and i32 %42, 255
%44 = and i32 %27, 255
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %39, i32 %41, i32 %43, i32 %44)
%46 = lshr i32 %28, 24
%47 = lshr i32 %28, 16
%48 = and i32 %47, 255
%49 = lshr i32 %28, 8
%50 = and i32 %49, 255
%51 = and i32 %28, 255
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %46, i32 %48, i32 %50, i32 %51)
br label %58
53: ; preds = %2
%54 = add nuw nsw i32 %3, 1
%55 = icmp eq i32 %54, 10
br i1 %55, label %56, label %2
56: ; preds = %53
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0))
br label %58
58: ; preds = %30, %56
%59 = phi i32 [ 0, %30 ], [ 1, %56 ]
ret i32 %59
}