#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*/ printf(char *, char *, char *);
char *dga(unsigned int day, unsigned int month, unsigned int year,
          unsigned int seed, unsigned int nr) {
  char *tlds[] = {"in", "me", "cc", "su", "tw", "net", "com", "pw", "org"};
  char domain[15];
  int d;
  int tld_index = day;
  for (d = 0; d < nr; d++) {
    unsigned int i;
    for (i = 0; i < 14; i++) {
      day = (day >> 15) ^ 16 * (day & 0x1FFF ^ 4 * (seed ^ day));
      year = ((year & 0xFFFFFFF0) << 17) ^ ((year ^ (7 * year)) >> 11);
      month = 14 * (month & 0xFFFFFFFE) ^ ((month ^ (4 * month)) >> 8);
      seed = (seed >> 6) ^ ((day + 8 * seed) << 8) & 0x3FFFF00;
      int x = ((day ^ month ^ year) % 25) + 97;
      domain[i] = x;
    }
    printf("%s.%s\n", domain, tlds[tld_index++ % 8]);
  }
}


x86 assembly (clang, -O0):
<dga>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c8a(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x88(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1286 <dga+0x166>
movl   $0x0,-0x8c(%rbp)
cmpl   $0xe,-0x8c(%rbp)
jae    1241 <dga+0x121>
mov    -0xc(%rbp),%eax
shr    $0xf,%eax
mov    -0xc(%rbp),%ecx
and    $0x1fff,%ecx
mov    -0x18(%rbp),%edx
xor    -0xc(%rbp),%edx
shl    $0x2,%edx
xor    %edx,%ecx
shl    $0x4,%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
and    $0xfffffff0,%eax
shl    $0x11,%eax
mov    -0x14(%rbp),%ecx
imul   $0x7,-0x14(%rbp),%edx
xor    %edx,%ecx
shr    $0xb,%ecx
xor    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
and    $0xfffffffe,%eax
imul   $0xe,%eax,%eax
mov    -0x10(%rbp),%ecx
mov    -0x10(%rbp),%edx
shl    $0x2,%edx
xor    %edx,%ecx
shr    $0x8,%ecx
xor    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
shr    $0x6,%eax
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%edx
shl    $0x3,%edx
add    %edx,%ecx
shl    $0x8,%ecx
and    $0x3ffff00,%ecx
xor    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    $0x19,%ecx
xor    %edx,%edx
div    %ecx
add    $0x61,%edx
mov    %edx,-0x90(%rbp)
mov    -0x90(%rbp),%eax
mov    %al,%cl
mov    -0x8c(%rbp),%eax
mov    %cl,-0x7f(%rbp,%rax,1)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    117c <dga+0x5c>
lea    -0x7f(%rbp),%rsi
mov    -0x88(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x88(%rbp)
mov    $0x8,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x70(%rbp,%rax,8),%rdx
lea    0xdb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1163 <dga+0x43>
mov    -0x8(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dga>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0x4(%rsp)
test   %r8d,%r8d
je     1234 <dga+0x124>
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%r12d
mov    %edi,%ebp
xor    %r13d,%r13d
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edx
shr    $0xf,%edx
mov    %ebp,%esi
xor    %ebx,%esi
shl    $0x6,%esi
shl    $0x4,%ebp
and    $0x1fff0,%ebp
xor    %edx,%ebp
xor    %esi,%ebp
mov    %r15d,%edx
and    $0xfffffff0,%edx
shl    $0x11,%edx
lea    0x0(,%r15,8),%esi
sub    %r15d,%esi
xor    %r15d,%esi
shr    $0xb,%esi
mov    %esi,%r15d
or     %edx,%r15d
lea    0x0(,%r12,4),%edx
xor    %r12d,%edx
mov    %r12d,%esi
and    $0xfffffffe,%esi
mov    %esi,%edi
shl    $0x4,%edi
sub    %esi,%edi
sub    %esi,%edi
shr    $0x8,%edx
mov    %edx,%r12d
xor    %edi,%r12d
mov    %ebx,%edx
shr    $0x6,%edx
lea    0x0(%rbp,%rbx,8),%ebx
shl    $0x8,%ebx
and    $0x3ffff00,%ebx
xor    %edx,%ebx
mov    %r12d,%edx
xor    %r15d,%edx
xor    %ebp,%edx
imul   $0x51eb851f,%rdx,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,4),%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
add    $0x61,%dl
mov    %dl,0x9(%rsp,%rcx,1)
add    $0x1,%rcx
cmp    $0xe,%rcx
jne    1150 <dga+0x40>
lea    0x1(%rax),%r14d
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cltq
lea    0xe1e(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
lea    0xe06(%rip),%rdi
lea    0x9(%rsp),%rsi
call   1030 <printf@plt>
add    $0x1,%r13d
mov    %r14d,%eax
cmp    0x4(%rsp),%r13d
jne    1140 <dga+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"in\00"
@.str.1 = [3 x i8] c"me\00"
@.str.2 = [3 x i8] c"cc\00"
@.str.3 = [3 x i8] c"su\00"
@.str.4 = [3 x i8] c"tw\00"
@.str.5 = [4 x i8] c"net\00"
@.str.6 = [4 x i8] c"com\00"
@.str.7 = [3 x i8] c"pw\00"
@.str.8 = [4 x i8] c"org\00"
@__const.dga.tlds = [9 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0)]
@.str.9 = [7 x i8] c"%s.%s\0A\00"
define i8* @dga(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [9 x i8*]
%13 = alloca [15 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%18 = bitcast [9 x i8*]* %12 to i8*
%19 = load i32, i32* %7
store i32 %19, i32* %15
store i32 0, i32* %14
br label %20
20: ; preds = %91, %5
%21 = load i32, i32* %14
%22 = load i32, i32* %11
%23 = icmp ult i32 %21, %22
br i1 %23, label %24, label %94
24: ; preds = %20
store i32 0, i32* %16
br label %25
25: ; preds = %79, %24
%26 = load i32, i32* %16
%27 = icmp ult i32 %26, 14
br i1 %27, label %28, label %82
28: ; preds = %25
%29 = load i32, i32* %7
%30 = lshr i32 %29, 15
%31 = load i32, i32* %7
%32 = and i32 %31, 8191
%33 = load i32, i32* %10
%34 = load i32, i32* %7
%35 = xor i32 %33, %34
%36 = mul i32 4, %35
%37 = xor i32 %32, %36
%38 = mul i32 16, %37
%39 = xor i32 %30, %38
store i32 %39, i32* %7
%40 = load i32, i32* %9
%41 = and i32 %40, -16
%42 = shl i32 %41, 17
%43 = load i32, i32* %9
%44 = load i32, i32* %9
%45 = mul i32 7, %44
%46 = xor i32 %43, %45
%47 = lshr i32 %46, 11
%48 = xor i32 %42, %47
store i32 %48, i32* %9
%49 = load i32, i32* %8
%50 = and i32 %49, -2
%51 = mul i32 14, %50
%52 = load i32, i32* %8
%53 = load i32, i32* %8
%54 = mul i32 4, %53
%55 = xor i32 %52, %54
%56 = lshr i32 %55, 8
%57 = xor i32 %51, %56
store i32 %57, i32* %8
%58 = load i32, i32* %10
%59 = lshr i32 %58, 6
%60 = load i32, i32* %7
%61 = load i32, i32* %10
%62 = mul i32 8, %61
%63 = add i32 %60, %62
%64 = shl i32 %63, 8
%65 = and i32 %64, 67108608
%66 = xor i32 %59, %65
store i32 %66, i32* %10
%67 = load i32, i32* %7
%68 = load i32, i32* %8
%69 = xor i32 %67, %68
%70 = load i32, i32* %9
%71 = xor i32 %69, %70
%72 = urem i32 %71, 25
%73 = add i32 %72, 97
store i32 %73, i32* %17
%74 = load i32, i32* %17
%75 = trunc i32 %74 to i8
%76 = load i32, i32* %16
%77 = zext i32 %76 to i64
%78 = getelementptr inbounds [15 x i8], [15 x i8]* %13, i64 0, i64 %77
store i8 %75, i8* %78
br label %79
79: ; preds = %28
%80 = load i32, i32* %16
%81 = add i32 %80, 1
store i32 %81, i32* %16
br label %25
82: ; preds = %25
%83 = getelementptr inbounds [15 x i8], [15 x i8]* %13, i64 0, i64 0
%84 = load i32, i32* %15
%85 = add nsw i32 %84, 1
store i32 %85, i32* %15
%86 = srem i32 %84, 8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [9 x i8*], [9 x i8*]* %12, i64 0, i64 %87
%89 = load i8*, i8** %88
%90 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %83, i8* %89)
br label %91
91: ; preds = %82
%92 = load i32, i32* %14
%93 = add nsw i32 %92, 1
store i32 %93, i32* %14
br label %20
94: ; preds = %20
%95 = load i8*, i8** %6
ret i8* %95
}

LLVM IR (-O2):
@.str = [3 x i8] c"in\00"
@.str.1 = [3 x i8] c"me\00"
@.str.2 = [3 x i8] c"cc\00"
@.str.3 = [3 x i8] c"su\00"
@.str.4 = [3 x i8] c"tw\00"
@.str.5 = [4 x i8] c"net\00"
@.str.6 = [4 x i8] c"com\00"
@.str.7 = [3 x i8] c"pw\00"
@.str.8 = [4 x i8] c"org\00"
@reltable.dga = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([9 x i32]* @reltable.dga to i64)) to i32)]
@.str.9 = [7 x i8] c"%s.%s\0A\00"
define noalias i8* @dga(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [15 x i8]
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%8 = icmp eq i32 %4, 0
br i1 %8, label %64, label %9
9: ; preds = %5, %55
%10 = phi i32 [ %28, %55 ], [ %0, %5 ]
%11 = phi i32 [ %56, %55 ], [ %0, %5 ]
%12 = phi i32 [ %62, %55 ], [ 0, %5 ]
%13 = phi i32 [ %40, %55 ], [ %1, %5 ]
%14 = phi i32 [ %46, %55 ], [ %3, %5 ]
%15 = phi i32 [ %34, %55 ], [ %2, %5 ]
br label %16
16: ; preds = %9, %16
%17 = phi i64 [ 0, %9 ], [ %53, %16 ]
%18 = phi i32 [ %10, %9 ], [ %28, %16 ]
%19 = phi i32 [ %13, %9 ], [ %40, %16 ]
%20 = phi i32 [ %14, %9 ], [ %46, %16 ]
%21 = phi i32 [ %15, %9 ], [ %34, %16 ]
%22 = lshr i32 %18, 15
%23 = xor i32 %18, %20
%24 = shl i32 %23, 6
%25 = shl i32 %18, 4
%26 = and i32 %25, 131056
%27 = xor i32 %26, %22
%28 = xor i32 %27, %24
%29 = shl i32 %21, 17
%30 = and i32 %29, -2097152
%31 = mul i32 %21, 7
%32 = xor i32 %31, %21
%33 = lshr i32 %32, 11
%34 = or i32 %33, %30
%35 = and i32 %19, -2
%36 = mul i32 %35, 14
%37 = shl i32 %19, 2
%38 = xor i32 %37, %19
%39 = lshr i32 %38, 8
%40 = xor i32 %39, %36
%41 = lshr i32 %20, 6
%42 = shl i32 %20, 3
%43 = add i32 %28, %42
%44 = shl i32 %43, 8
%45 = and i32 %44, 67108608
%46 = xor i32 %45, %41
%47 = xor i32 %40, %34
%48 = xor i32 %47, %28
%49 = urem i32 %48, 25
%50 = trunc i32 %49 to i8
%51 = add nuw nsw i8 %50, 97
%52 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 %17
store i8 %51, i8* %52
%53 = add nuw nsw i64 %17, 1
%54 = icmp eq i64 %53, 14
br i1 %54, label %55, label %16
55: ; preds = %16
%56 = add nsw i32 %11, 1
%57 = srem i32 %11, 8
%58 = sext i32 %57 to i64
%59 = shl i64 %58, 2
%60 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.dga to i8*), i64 %59)
%61 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %7, i8* %60)
%62 = add nuw i32 %12, 1
%63 = icmp eq i32 %62, %4
br i1 %63, label %64, label %9
64: ; preds = %55, %5
ret i8* undef
}