#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 /*<<< orphan*/ mangle(unsigned char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ printseed(unsigned char *);
int /*<<< orphan*/ printstream(unsigned char *, unsigned char);
int main(void) {
  unsigned char restart = 1;
  unsigned char keyseed[16] = {0x0, 0xb, 0x1, 0x4, 0xf, 0x4, 0xb, 0x5,
                               0x7, 0xf, 0xd, 0x6, 0x1, 0xe, 0x9, 0x8};
  unsigned char lockseed[16] = {0x0, 0x0, 0x9, 0xa, 0x1, 0x8, 0x5, 0xf,
                                0x1, 0x1, 0xe, 0x1, 0x0, 0xd, 0xe, 0xc};
  printseed(keyseed);
  printseed(lockseed);
  printf("\n");
  while (1) {
    printf("\n");
    printstream(keyseed, restart);
    printstream(lockseed, restart);
    mangle(keyseed);
    mangle(keyseed);
    mangle(keyseed);
    mangle(lockseed);
    mangle(lockseed);
    mangle(lockseed);
    restart = lockseed[7];
    if (!restart)
      restart = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x1,-0x5(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe9d(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <printseed@plt>
lea    -0x30(%rbp),%rdi
call   1050 <printseed@plt>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
movzbl -0x5(%rbp),%esi
call   1040 <printstream@plt>
lea    -0x30(%rbp),%rdi
movzbl -0x5(%rbp),%esi
call   1040 <printstream@plt>
lea    -0x20(%rbp),%rdi
call   1060 <mangle@plt>
lea    -0x20(%rbp),%rdi
call   1060 <mangle@plt>
lea    -0x20(%rbp),%rdi
call   1060 <mangle@plt>
lea    -0x30(%rbp),%rdi
call   1060 <mangle@plt>
lea    -0x30(%rbp),%rdi
call   1060 <mangle@plt>
lea    -0x30(%rbp),%rdi
call   1060 <mangle@plt>
mov    -0x29(%rbp),%al
mov    %al,-0x5(%rbp)
cmpb   $0x0,-0x5(%rbp)
jne    120d <main+0xcd>
movb   $0x1,-0x5(%rbp)
jmp    119d <main+0x5d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1050 <printseed@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <printseed@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%bpl
mov    $0x1,%r15d
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl %bpl,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printstream@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <printstream@plt>
mov    %r14,%rdi
call   1060 <mangle@plt>
mov    %r14,%rdi
call   1060 <mangle@plt>
mov    %r14,%rdi
call   1060 <mangle@plt>
mov    %rbx,%rdi
call   1060 <mangle@plt>
mov    %rbx,%rdi
call   1060 <mangle@plt>
mov    %rbx,%rdi
call   1060 <mangle@plt>
movzbl 0x7(%rsp),%ebp
test   %bpl,%bpl
cmove  %r15d,%ebp
jmp    1190 <main+0x50>

LLVM IR (-O0):
@__const.main.keyseed = [16 x i8] c"\00\0B\01\04\0F\04\0B\05\07\0F\0D\06\01\0E\09\08"
@__const.main.lockseed = [16 x i8] c"\00\00\09\0A\01\08\05\0F\01\01\0E\01\00\0D\0E\0C"
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
store i32 0, i32* %1
store i8 1, i8* %2
%5 = bitcast [16 x i8]* %3 to i8*
%6 = bitcast [16 x i8]* %4 to i8*
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = call i32 @printseed(i8* %7)
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%10 = call i32 @printseed(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %0, %37
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%15 = load i8, i8* %2
%16 = call i32 @printstream(i8* %14, i8 zeroext %15)
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%18 = load i8, i8* %2
%19 = call i32 @printstream(i8* %17, i8 zeroext %18)
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%21 = call i32 @mangle(i8* %20)
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%23 = call i32 @mangle(i8* %22)
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%25 = call i32 @mangle(i8* %24)
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%27 = call i32 @mangle(i8* %26)
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%29 = call i32 @mangle(i8* %28)
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%31 = call i32 @mangle(i8* %30)
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 7
%33 = load i8, i8* %32
store i8 %33, i8* %2
%34 = load i8, i8* %2
%35 = icmp ne i8 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %12
store i8 1, i8* %2
br label %37
37: ; preds = %36, %12
br label %12
}

LLVM IR (-O2):
@__const.main.keyseed = [16 x i8] c"\00\0B\01\04\0F\04\0B\05\07\0F\0D\06\01\0E\09\08"
@__const.main.lockseed = [16 x i8] c"\00\00\09\0A\01\08\05\0F\01\01\0E\01\00\0D\0E\0C"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @printseed(i8* %3)
%6 = call i32 @printseed(i8* %4)
%7 = call i32 @putchar(i32 10)
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 7
br label %9
9: ; preds = %9, %0
%10 = phi i8 [ 1, %0 ], [ %22, %9 ]
%11 = call i32 @putchar(i32 10)
%12 = call i32 @printstream(i8* %3, i8 zeroext %10)
%13 = call i32 @printstream(i8* %4, i8 zeroext %10)
%14 = call i32 @mangle(i8* %3)
%15 = call i32 @mangle(i8* %3)
%16 = call i32 @mangle(i8* %3)
%17 = call i32 @mangle(i8* %4)
%18 = call i32 @mangle(i8* %4)
%19 = call i32 @mangle(i8* %4)
%20 = load i8, i8* %8
%21 = icmp eq i8 %20, 0
%22 = select i1 %21, i8 1, i8 %20
br label %9
}