#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 /*<<< orphan*/ pbData;
typedef int /*<<< orphan*/ URL;
typedef int /*<<< orphan*/ TLD;

/* Variables and functions */
scalar_t__ GetMD5Hash(unsigned char *, int, unsigned char *);
int /*<<< orphan*/ genDate(unsigned char *);
int /*<<< orphan*/ genSuppliedDate(char **, unsigned char *);
scalar_t__ genTLD(unsigned short, char *);
scalar_t__ genURL(unsigned char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
unsigned short strlen(char *);
int main(int argc, char *argv[]) {
  unsigned char dateData[3];
  char URL[33] = {};
  char TLD[6];
  if (argc == 2) {
    if (!(genSuppliedDate(argv, dateData))) {
      return 0;
    }
  } else if (!(genDate(dateData))) {
    printf("Failed to generate date hash data, exiting");
    return 0;
  }
  unsigned short i;
  for (i = 0; i < 1000; i++) {
    unsigned char hashValue[16];
    memset(URL, 0, sizeof(URL));
    memset(TLD, 0, sizeof(TLD));
    unsigned char hibyte = (i >> 8) & 0xff;
    unsigned char lobyte = (i & 0xff);
    unsigned char pbData[7] = {dateData[0], dateData[1], dateData[2], lobyte,
                               hibyte,      0x00,        0x00};
    if (GetMD5Hash(pbData, sizeof(pbData), hashValue)) {
      if (genURL(hashValue, URL)) {
        unsigned short k;
        for (k = 0; k < strlen(URL); k++) {
          printf("%c", URL[k]);
        }
        if (genTLD(i, TLD)) {
          for (k = 0; k < strlen(TLD); k++) {
            printf("%c", TLD[k]);
          }
          printf("\n");
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1060 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11da <main+0x5a>
mov    -0x10(%rbp),%rdi
lea    -0x13(%rbp),%rsi
call   1090 <genSuppliedDate@plt>
cmp    $0x0,%eax
jne    11d5 <main+0x55>
movl   $0x0,-0x4(%rbp)
jmp    13a1 <main+0x221>
jmp    120b <main+0x8b>
lea    -0x13(%rbp),%rdi
call   1040 <genDate@plt>
cmp    $0x0,%eax
jne    1206 <main+0x86>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a1 <main+0x221>
jmp    120b <main+0x8b>
movw   $0x0,-0x48(%rbp)
movzwl -0x48(%rbp),%eax
cmp    $0x3e8,%eax
jge    139a <main+0x21a>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1060 <memset@plt>
lea    -0x46(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1060 <memset@plt>
movzwl -0x48(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x61(%rbp)
movzwl -0x48(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x62(%rbp)
mov    -0x13(%rbp),%al
mov    %al,-0x69(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x68(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x67(%rbp)
mov    -0x62(%rbp),%al
mov    %al,-0x66(%rbp)
mov    -0x61(%rbp),%al
mov    %al,-0x65(%rbp)
movb   $0x0,-0x64(%rbp)
movb   $0x0,-0x63(%rbp)
lea    -0x69(%rbp),%rdi
lea    -0x60(%rbp),%rdx
mov    $0x7,%esi
call   1070 <GetMD5Hash@plt>
cmp    $0x0,%rax
je     1384 <main+0x204>
lea    -0x60(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <genURL@plt>
cmp    $0x0,%rax
je     137f <main+0x1ff>
movw   $0x0,-0x6c(%rbp)
movzwl -0x6c(%rbp),%eax
mov    %eax,-0x70(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %ax,%cx
mov    -0x70(%rbp),%eax
movzwl %cx,%ecx
cmp    %ecx,%eax
jge    1303 <main+0x183>
movzwl -0x6c(%rbp),%eax
movsbl -0x40(%rbp,%rax,1),%esi
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x6c(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6c(%rbp)
jmp    12ba <main+0x13a>
mov    -0x48(%rbp),%ax
lea    -0x46(%rbp),%rsi
movzwl %ax,%edi
call   10a0 <genTLD@plt>
cmp    $0x0,%rax
je     137a <main+0x1fa>
movw   $0x0,-0x6c(%rbp)
movzwl -0x6c(%rbp),%eax
mov    %eax,-0x74(%rbp)
lea    -0x46(%rbp),%rdi
call   1030 <strlen@plt>
mov    %ax,%cx
mov    -0x74(%rbp),%eax
movzwl %cx,%ecx
cmp    %ecx,%eax
jge    136c <main+0x1ec>
movzwl -0x6c(%rbp),%eax
movsbl -0x46(%rbp,%rax,1),%esi
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x6c(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6c(%rbp)
jmp    1323 <main+0x1a3>
lea    0xcbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    137f <main+0x1ff>
jmp    1384 <main+0x204>
jmp    1389 <main+0x209>
mov    -0x48(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x48(%rbp)
jmp    1211 <main+0x91>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x30(%rsp)
cmp    $0x2,%edi
jne    11cc <main+0x3c>
mov    %rsp,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   10a0 <genSuppliedDate@plt>
test   %eax,%eax
jne    11dc <main+0x4c>
jmp    1311 <main+0x181>
mov    %rsp,%rdi
call   1050 <genDate@plt>
test   %eax,%eax
je     1303 <main+0x173>
xor    %ebx,%ebx
lea    0x10(%rsp),%r13
lea    0xa(%rsp),%r14
lea    0x3(%rsp),%r15
lea    0x40(%rsp),%r12
jmp    121b <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
movzwl %bx,%eax
cmp    $0x3e8,%eax
je     1311 <main+0x181>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1070 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1070 <memset@plt>
mov    (%rsp),%al
mov    %al,0x3(%rsp)
movzwl 0x1(%rsp),%eax
mov    %ax,0x4(%rsp)
mov    %bl,0x6(%rsp)
mov    %bh,0x7(%rsp)
movw   $0x0,0x8(%rsp)
mov    %r15,%rdi
mov    $0x7,%esi
mov    %r12,%rdx
call   1080 <GetMD5Hash@plt>
test   %rax,%rax
je     120a <main+0x7a>
mov    %r12,%rdi
mov    %r13,%rsi
call   1090 <genURL@plt>
test   %rax,%rax
je     120a <main+0x7a>
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %ax,%ax
je     12ae <main+0x11e>
xor    %ebp,%ebp
nopl   (%rax)
movsbl 0x10(%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
mov    %r13,%rdi
call   1040 <strlen@plt>
movzwl %ax,%eax
cmp    %rax,%rbp
jb     1290 <main+0x100>
movzwl %bx,%edi
mov    %r14,%rsi
call   10b0 <genTLD@plt>
test   %rax,%rax
je     120a <main+0x7a>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %ax,%ax
je     1200 <main+0x70>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0xa(%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
mov    %r14,%rdi
call   1040 <strlen@plt>
movzwl %ax,%eax
cmp    %rax,%rbp
jb     12e0 <main+0x150>
jmp    1200 <main+0x70>
lea    0xcf6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Failed to generate date hash data, exiting\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i8]
%7 = alloca [33 x i8]
%8 = alloca [6 x i8]
%9 = alloca i16
%10 = alloca [16 x i8]
%11 = alloca i8
%12 = alloca i8
%13 = alloca [7 x i8]
%14 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [33 x i8]* %7 to i8*
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %25
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%21 = call i32 @genSuppliedDate(i8** %19, i8* %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %18
store i32 0, i32* %3
br label %125
24: ; preds = %18
br label %32
25: ; preds = %2
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%27 = call i32 @genDate(i8* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %125
31: ; preds = %25
br label %32
32: ; preds = %31, %24
store i16 0, i16* %9
br label %33
33: ; preds = %121, %32
%34 = load i16, i16* %9
%35 = zext i16 %34 to i32
%36 = icmp slt i32 %35, 1000
br i1 %36, label %37, label %124
37: ; preds = %33
%38 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%39 = call i32 @memset(i8* %38, i32 0, i32 33)
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%41 = call i32 @memset(i8* %40, i32 0, i32 6)
%42 = load i16, i16* %9
%43 = zext i16 %42 to i32
%44 = ashr i32 %43, 8
%45 = and i32 %44, 255
%46 = trunc i32 %45 to i8
store i8 %46, i8* %11
%47 = load i16, i16* %9
%48 = zext i16 %47 to i32
%49 = and i32 %48, 255
%50 = trunc i32 %49 to i8
store i8 %50, i8* %12
%51 = getelementptr inbounds [7 x i8], [7 x i8]* %13, i64 0, i64 0
%52 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%53 = load i8, i8* %52
store i8 %53, i8* %51
%54 = getelementptr inbounds i8, i8* %51, i64 1
%55 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 1
%56 = load i8, i8* %55
store i8 %56, i8* %54
%57 = getelementptr inbounds i8, i8* %54, i64 1
%58 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 2
%59 = load i8, i8* %58
store i8 %59, i8* %57
%60 = getelementptr inbounds i8, i8* %57, i64 1
%61 = load i8, i8* %12
store i8 %61, i8* %60
%62 = getelementptr inbounds i8, i8* %60, i64 1
%63 = load i8, i8* %11
store i8 %63, i8* %62
%64 = getelementptr inbounds i8, i8* %62, i64 1
store i8 0, i8* %64
%65 = getelementptr inbounds i8, i8* %64, i64 1
store i8 0, i8* %65
%66 = getelementptr inbounds [7 x i8], [7 x i8]* %13, i64 0, i64 0
%67 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%68 = call i64 @GetMD5Hash(i8* %66, i32 7, i8* %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %120
70: ; preds = %37
%71 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%72 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%73 = call i64 @genURL(i8* %71, i8* %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %119
75: ; preds = %70
store i16 0, i16* %14
br label %76
76: ; preds = %90, %75
%77 = load i16, i16* %14
%78 = zext i16 %77 to i32
%79 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%80 = call zeroext i16 @strlen(i8* %79)
%81 = zext i16 %80 to i32
%82 = icmp slt i32 %78, %81
br i1 %82, label %83, label %93
83: ; preds = %76
%84 = load i16, i16* %14
%85 = zext i16 %84 to i64
%86 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 %85
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %88)
br label %90
90: ; preds = %83
%91 = load i16, i16* %14
%92 = add i16 %91, 1
store i16 %92, i16* %14
br label %76
93: ; preds = %76
%94 = load i16, i16* %9
%95 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%96 = call i64 @genTLD(i16 zeroext %94, i8* %95)
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %118
98: ; preds = %93
store i16 0, i16* %14
br label %99
99: ; preds = %113, %98
%100 = load i16, i16* %14
%101 = zext i16 %100 to i32
%102 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%103 = call zeroext i16 @strlen(i8* %102)
%104 = zext i16 %103 to i32
%105 = icmp slt i32 %101, %104
br i1 %105, label %106, label %116
106: ; preds = %99
%107 = load i16, i16* %14
%108 = zext i16 %107 to i64
%109 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 %108
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %106
%114 = load i16, i16* %14
%115 = add i16 %114, 1
store i16 %115, i16* %14
br label %99
116: ; preds = %99
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %118
118: ; preds = %116, %93
br label %119
119: ; preds = %118, %70
br label %120
120: ; preds = %119, %37
br label %121
121: ; preds = %120
%122 = load i16, i16* %9
%123 = add i16 %122, 1
store i16 %123, i16* %9
br label %33
124: ; preds = %33
store i32 0, i32* %3
br label %125
125: ; preds = %124, %29, %23
%126 = load i32, i32* %3
ret i32 %126
}

LLVM IR (-O2):
@.str = [43 x i8] c"Failed to generate date hash data, exiting\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [3 x i8]
%4 = alloca [33 x i8]
%5 = alloca [6 x i8]
%6 = alloca [16 x i8]
%7 = alloca [7 x i8]
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%11 = icmp eq i32 %0, 2
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @genSuppliedDate(i8** %1, i8* %8)
%14 = icmp eq i32 %13, 0
br i1 %14, label %80, label %20
15: ; preds = %2
%16 = call i32 @genDate(i8* %8)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %80
20: ; preds = %15, %12
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 1
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 1
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 2
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 3
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 4
%29 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 5
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 6
br label %31
31: ; preds = %20, %77
%32 = phi i16 [ 0, %20 ], [ %78, %77 ]
%33 = call i32 @memset(i8* %9, i32 0, i32 33)
%34 = call i32 @memset(i8* %10, i32 0, i32 6)
%35 = lshr i16 %32, 8
%36 = trunc i16 %35 to i8
%37 = trunc i16 %32 to i8
%38 = load i8, i8* %8
store i8 %38, i8* %22
%39 = load i8, i8* %24
store i8 %39, i8* %23
%40 = load i8, i8* %26
store i8 %40, i8* %25
store i8 %37, i8* %27
store i8 %36, i8* %28
store i8 0, i8* %29
store i8 0, i8* %30
%41 = call i64 @GetMD5Hash(i8* %22, i32 7, i8* %21)
%42 = icmp eq i64 %41, 0
br i1 %42, label %77, label %43
43: ; preds = %31
%44 = call i64 @genURL(i8* %21, i8* %9)
%45 = icmp eq i64 %44, 0
br i1 %45, label %77, label %46
46: ; preds = %43
%47 = call zeroext i16 @strlen(i8* %9)
%48 = icmp eq i16 %47, 0
br i1 %48, label %59, label %49
49: ; preds = %46, %49
%50 = phi i64 [ %55, %49 ], [ 0, %46 ]
%51 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = call i32 @putchar(i32 %53)
%55 = add nuw nsw i64 %50, 1
%56 = call zeroext i16 @strlen(i8* %9)
%57 = zext i16 %56 to i64
%58 = icmp ult i64 %55, %57
br i1 %58, label %49, label %59
59: ; preds = %49, %46
%60 = call i64 @genTLD(i16 zeroext %32, i8* %10)
%61 = icmp eq i64 %60, 0
br i1 %61, label %77, label %62
62: ; preds = %59
%63 = call zeroext i16 @strlen(i8* %10)
%64 = icmp eq i16 %63, 0
br i1 %64, label %75, label %65
65: ; preds = %62, %65
%66 = phi i64 [ %71, %65 ], [ 0, %62 ]
%67 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = call i32 @putchar(i32 %69)
%71 = add nuw nsw i64 %66, 1
%72 = call zeroext i16 @strlen(i8* %10)
%73 = zext i16 %72 to i64
%74 = icmp ult i64 %71, %73
br i1 %74, label %65, label %75
75: ; preds = %65, %62
%76 = call i32 @putchar(i32 10)
br label %77
77: ; preds = %59, %75, %43, %31
%78 = add nuw nsw i16 %32, 1
%79 = icmp eq i16 %78, 1000
br i1 %79, label %80, label %31
80: ; preds = %77, %12, %18
ret i32 0
}