#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, char);
int rand();
int main(int argc, char *argv[]) {
  uint32_t op1;
  uint32_t op2;
  uint32_t x;
  char op;
  uint32_t i;
  uint32_t v;
  for (i = 0; i < 1024 * 1024; ++i) {
    x = ((rand() & 0x0700) >> 8);
    switch (x) {
    case 1:
      op1 = rand();
      op2 = rand();
      op = '+';
      v = op2 + op1;
      break;
    case 2:
      op1 = rand();
      op2 = rand();
      op = '-';
      v = op1 - op2;
      break;
    case 3:
      op1 = rand() & 0x000fffff;
      op2 = rand() & 0x000fffff;
      ;
      op = '*';
      v = op2 * op1;
      break;
    case 4:
      op1 = rand() & 0x000fffff;
      op2 = rand() & 0x000fffff;
      ;
      op = '|';
      v = op2 | op1;
      break;
    case 5:
      op1 = rand() & 0x000fffff;
      op2 = rand() & 0x000fffff;
      ;
      op = '&';
      v = op2 & op1;
      break;
    case 6:
      op1 = rand() & 0x000fffff;
      op2 = rand() & 0x000fffff;
      ;
      op = '^';
      v = op2 ^ op1;
      break;
    case 7:
      op1 = rand() & 0x000fffff;
      op = '~';
      v = ~op1;
      break;
    case 0:
    default:
      op1 = rand() & 0x0000ffff;
      if (op1 == 0) {
        op1 = 1;
      }
      op2 = rand();
      op = '/';
      v = op2 / op1;
      break;
    }
    printf("0x%08x,0x%08x,0x%08x,%c\n", op1, op2, v, op);
    op1++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x100000,-0x24(%rbp)
jge    131b <main+0x1fb>
xor    %eax,%eax
call   1040 <rand@plt>
shr    $0x8,%eax
and    $0x7,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x30(%rbp)
sub    $0x7,%rax
ja     12b2 <main+0x192>
mov    -0x30(%rbp),%rax
lea    0xe8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x18(%rbp)
movb   $0x2b,-0x1d(%rbp)
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x18(%rbp)
movb   $0x2d,-0x1d(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x18(%rbp)
movb   $0x2a,-0x1d(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x18(%rbp)
movb   $0x7c,-0x1d(%rbp)
mov    -0x18(%rbp),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x18(%rbp)
movb   $0x26,-0x1d(%rbp)
mov    -0x18(%rbp),%eax
and    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x18(%rbp)
movb   $0x5e,-0x1d(%rbp)
mov    -0x18(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xfffff,%eax
mov    %eax,-0x14(%rbp)
movb   $0x7e,-0x1d(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    12ea <main+0x1ca>
jmp    12b2 <main+0x192>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0xffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    12d2 <main+0x1b2>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x18(%rbp)
movb   $0x2f,-0x1d(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xd26(%rip),%rdi
movsbl -0x1d(%rbp),%r8d
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x100000,%ebx
mov    $0x1,%r12d
lea    0xedf(%rip),%r14
lea    0xebc(%rip),%r13
jmp    118a <main+0x6a>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
and    $0xfffff,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ecx
mov    %eax,%r15d
and    $0xfffff,%r15d
and    %ebp,%ecx
mov    $0x26,%al
nopl   0x0(%rax)
movzbl %al,%r8d
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1030 <printf@plt>
add    $0xffffffff,%ebx
je     12a4 <main+0x184>
xor    %eax,%eax
call   1040 <rand@plt>
shr    $0x8,%eax
and    $0x7,%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     121a <main+0xfa>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%r15d
mov    %eax,%ecx
add    %ebp,%ecx
mov    $0x2b,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
and    $0xfffff,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%r15d
and    $0xfffff,%r15d
mov    %r15d,%ecx
imul   %ebp,%ecx
mov    $0x2a,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
and    $0xfffff,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%r15d
and    $0xfffff,%r15d
mov    %r15d,%ecx
or     %ebp,%ecx
mov    $0x7c,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
call   1040 <rand@plt>
movzwl %ax,%ebp
test   %ebp,%ebp
cmove  %r12d,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%r15d
cltd
idiv   %ebp
mov    %eax,%ecx
mov    $0x2f,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%r15d
mov    %ebp,%ecx
sub    %eax,%ecx
mov    $0x2d,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
and    $0xfffff,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%r15d
and    $0xfffff,%r15d
mov    %r15d,%ecx
xor    %ebp,%ecx
mov    $0x5e,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
and    $0xfffff,%ebp
mov    %ebp,%ecx
not    %ecx
mov    $0x7e,%al
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"0x%08x,0x%08x,0x%08x,%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
br label %12
12: ; preds = %89, %2
%13 = load i32, i32* %10
%14 = icmp slt i32 %13, 1048576
br i1 %14, label %15, label %92
15: ; preds = %12
%16 = call i32 (...) @rand()
%17 = and i32 %16, 1792
%18 = ashr i32 %17, 8
store i32 %18, i32* %8
%19 = load i32, i32* %8
switch i32 %19, label %70 [
i32 1, label %20
i32 2, label %26
i32 3, label %32
i32 4, label %40
i32 5, label %48
i32 6, label %56
i32 7, label %64
i32 0, label %69
]
20: ; preds = %15
%21 = call i32 (...) @rand()
store i32 %21, i32* %6
%22 = call i32 (...) @rand()
store i32 %22, i32* %7
store i8 43, i8* %9
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = add nsw i32 %23, %24
store i32 %25, i32* %11
br label %81
26: ; preds = %15
%27 = call i32 (...) @rand()
store i32 %27, i32* %6
%28 = call i32 (...) @rand()
store i32 %28, i32* %7
store i8 45, i8* %9
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = sub nsw i32 %29, %30
store i32 %31, i32* %11
br label %81
32: ; preds = %15
%33 = call i32 (...) @rand()
%34 = and i32 %33, 1048575
store i32 %34, i32* %6
%35 = call i32 (...) @rand()
%36 = and i32 %35, 1048575
store i32 %36, i32* %7
store i8 42, i8* %9
%37 = load i32, i32* %7
%38 = load i32, i32* %6
%39 = mul nsw i32 %37, %38
store i32 %39, i32* %11
br label %81
40: ; preds = %15
%41 = call i32 (...) @rand()
%42 = and i32 %41, 1048575
store i32 %42, i32* %6
%43 = call i32 (...) @rand()
%44 = and i32 %43, 1048575
store i32 %44, i32* %7
store i8 124, i8* %9
%45 = load i32, i32* %7
%46 = load i32, i32* %6
%47 = or i32 %45, %46
store i32 %47, i32* %11
br label %81
48: ; preds = %15
%49 = call i32 (...) @rand()
%50 = and i32 %49, 1048575
store i32 %50, i32* %6
%51 = call i32 (...) @rand()
%52 = and i32 %51, 1048575
store i32 %52, i32* %7
store i8 38, i8* %9
%53 = load i32, i32* %7
%54 = load i32, i32* %6
%55 = and i32 %53, %54
store i32 %55, i32* %11
br label %81
56: ; preds = %15
%57 = call i32 (...) @rand()
%58 = and i32 %57, 1048575
store i32 %58, i32* %6
%59 = call i32 (...) @rand()
%60 = and i32 %59, 1048575
store i32 %60, i32* %7
store i8 94, i8* %9
%61 = load i32, i32* %7
%62 = load i32, i32* %6
%63 = xor i32 %61, %62
store i32 %63, i32* %11
br label %81
64: ; preds = %15
%65 = call i32 (...) @rand()
%66 = and i32 %65, 1048575
store i32 %66, i32* %6
store i8 126, i8* %9
%67 = load i32, i32* %6
%68 = xor i32 %67, -1
store i32 %68, i32* %11
br label %81
69: ; preds = %15
br label %70
70: ; preds = %15, %69
%71 = call i32 (...) @rand()
%72 = and i32 %71, 65535
store i32 %72, i32* %6
%73 = load i32, i32* %6
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %76
75: ; preds = %70
store i32 1, i32* %6
br label %76
76: ; preds = %75, %70
%77 = call i32 (...) @rand()
store i32 %77, i32* %7
store i8 47, i8* %9
%78 = load i32, i32* %7
%79 = load i32, i32* %6
%80 = sdiv i32 %78, %79
store i32 %80, i32* %11
br label %81
81: ; preds = %76, %64, %56, %48, %40, %32, %26, %20
%82 = load i32, i32* %6
%83 = load i32, i32* %7
%84 = load i32, i32* %11
%85 = load i8, i8* %9
%86 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %82, i32 %83, i32 %84, i8 signext %85)
%87 = load i32, i32* %6
%88 = add nsw i32 %87, 1
store i32 %88, i32* %6
br label %89
89: ; preds = %81
%90 = load i32, i32* %10
%91 = add nsw i32 %90, 1
store i32 %91, i32* %10
br label %12
92: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"0x%08x,0x%08x,0x%08x,%c\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %52
%4 = phi i32 [ 0, %2 ], [ %58, %52 ]
%5 = phi i32 [ undef, %2 ], [ %54, %52 ]
%6 = tail call i32 (...) @rand()
%7 = lshr i32 %6, 8
%8 = and i32 %7, 7
switch i32 %8, label %45 [
i32 1, label %9
i32 2, label %13
i32 3, label %17
i32 4, label %23
i32 5, label %29
i32 6, label %35
i32 7, label %41
]
9: ; preds = %3
%10 = tail call i32 (...) @rand()
%11 = tail call i32 (...) @rand()
%12 = add nsw i32 %11, %10
br label %52
13: ; preds = %3
%14 = tail call i32 (...) @rand()
%15 = tail call i32 (...) @rand()
%16 = sub nsw i32 %14, %15
br label %52
17: ; preds = %3
%18 = tail call i32 (...) @rand()
%19 = and i32 %18, 1048575
%20 = tail call i32 (...) @rand()
%21 = and i32 %20, 1048575
%22 = mul nsw i32 %21, %19
br label %52
23: ; preds = %3
%24 = tail call i32 (...) @rand()
%25 = and i32 %24, 1048575
%26 = tail call i32 (...) @rand()
%27 = and i32 %26, 1048575
%28 = or i32 %27, %25
br label %52
29: ; preds = %3
%30 = tail call i32 (...) @rand()
%31 = and i32 %30, 1048575
%32 = tail call i32 (...) @rand()
%33 = and i32 %32, 1048575
%34 = and i32 %32, %31
br label %52
35: ; preds = %3
%36 = tail call i32 (...) @rand()
%37 = and i32 %36, 1048575
%38 = tail call i32 (...) @rand()
%39 = and i32 %38, 1048575
%40 = xor i32 %39, %37
br label %52
41: ; preds = %3
%42 = tail call i32 (...) @rand()
%43 = and i32 %42, 1048575
%44 = xor i32 %43, -1
br label %52
45: ; preds = %3
%46 = tail call i32 (...) @rand()
%47 = and i32 %46, 65535
%48 = icmp eq i32 %47, 0
%49 = select i1 %48, i32 1, i32 %47
%50 = tail call i32 (...) @rand()
%51 = sdiv i32 %50, %49
br label %52
52: ; preds = %45, %41, %35, %29, %23, %17, %13, %9
%53 = phi i32 [ %49, %45 ], [ %43, %41 ], [ %37, %35 ], [ %31, %29 ], [ %25, %23 ], [ %19, %17 ], [ %14, %13 ], [ %10, %9 ]
%54 = phi i32 [ %50, %45 ], [ %5, %41 ], [ %39, %35 ], [ %33, %29 ], [ %27, %23 ], [ %21, %17 ], [ %15, %13 ], [ %11, %9 ]
%55 = phi i8 [ 47, %45 ], [ 126, %41 ], [ 94, %35 ], [ 38, %29 ], [ 124, %23 ], [ 42, %17 ], [ 45, %13 ], [ 43, %9 ]
%56 = phi i32 [ %51, %45 ], [ %44, %41 ], [ %40, %35 ], [ %34, %29 ], [ %28, %23 ], [ %22, %17 ], [ %16, %13 ], [ %12, %9 ]
%57 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %53, i32 %54, i32 %56, i8 signext %55)
%58 = add nuw nsw i32 %4, 1
%59 = icmp eq i32 %58, 1048576
br i1 %59, label %60, label %3
60: ; preds = %52
ret i32 0
}