#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*/ MD5(unsigned char const *, int const, unsigned char *);
int MD5_DIGEST_LENGTH;
int /*<<< orphan*/ SHA1(unsigned char const *, int const, unsigned char *);
int SHA_DIGEST_LENGTH;
int /*<<< orphan*/ print_hash(unsigned char *, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  const int data_len = 1234;
  const int data_size = data_len * sizeof(double) / sizeof(char);
  double data[data_len];
  for (int i = 0; i < data_len; i++) {
    data[i] = 0.123456789 * (double)i;
  }
  unsigned char hash_md5[MD5_DIGEST_LENGTH];
  unsigned char hash_sha1[SHA_DIGEST_LENGTH];
  MD5((const unsigned char *)data, data_size, hash_md5);
  SHA1((const unsigned char *)data, data_size, hash_sha1);
  printf("MD5()  = ");
  print_hash(hash_md5, MD5_DIGEST_LENGTH);
  printf("\n");
  printf("SHA1() = ");
  print_hash(hash_sha1, SHA_DIGEST_LENGTH);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x26d0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4d2,-0x8(%rbp)
movl   $0x2690,-0xc(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4d2,-0x1c(%rbp)
jge    11a7 <main+0x67>
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xe78(%rip),%xmm0
mulsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rax
movsd  %xmm0,-0x26c0(%rbp,%rax,8)
ff ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116e <main+0x2e>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x26d0(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x28(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x26c8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    -0x26c0(%rbp),%rdi
mov    $0x2690,%esi
call   1050 <MD5@plt>
mov    -0x26c8(%rbp),%rdx
lea    -0x26c0(%rbp),%rdi
mov    $0x2690,%esi
call   1060 <SHA1@plt>
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x26d0(%rbp),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
call   1040 <print_hash@plt>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
lea    0xdc0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x26c8(%rbp),%rdi
mov    0x2d81(%rip),%rax
mov    (%rax),%esi
call   1040 <print_hash@plt>
lea    0xd9d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2698,%rsp
movdqa 0xe94(%rip),%xmm0
mov    $0x6,%eax
movdqa 0xe96(%rip),%xmm8
movapd 0xe9e(%rip),%xmm2
movdqa 0xea6(%rip),%xmm3
movdqa 0xeae(%rip),%xmm4
movdqa 0xeb6(%rip),%xmm5
nopw   0x0(%rax,%rax,1)
movdqa %xmm0,%xmm6
cvtdq2pd %xmm0,%xmm7
paddd  %xmm8,%xmm6
cvtdq2pd %xmm6,%xmm6
mulpd  %xmm2,%xmm7
mulpd  %xmm2,%xmm6
movapd %xmm7,-0x26f0(%rbp,%rax,8)
ff ff
movdqa %xmm0,%xmm7
paddd  %xmm3,%xmm7
movdqa %xmm0,%xmm1
paddd  %xmm4,%xmm1
cvtdq2pd %xmm7,%xmm7
cvtdq2pd %xmm1,%xmm1
movapd %xmm6,-0x26e0(%rbp,%rax,8)
ff ff
mulpd  %xmm2,%xmm7
mulpd  %xmm2,%xmm1
movapd %xmm7,-0x26d0(%rbp,%rax,8)
ff ff
movapd %xmm1,-0x26c0(%rbp,%rax,8)
ff ff
paddd  %xmm5,%xmm0
add    $0x8,%rax
cmp    $0x4d6,%rax
jne    11a0 <main+0x50>
movabs $0x40630329133885c7,%rax
03 63 40
mov    %rax,-0x40(%rbp)
movabs $0x4063071c6edf6cf4,%rax
07 63 40
mov    %rax,-0x38(%rbp)
mov    0x2da8(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2d9c(%rip),%r12
mov    (%r12),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    -0x26c0(%rbp),%r15
mov    %r15,%rdi
mov    $0x2690,%esi
mov    %rbx,%rdx
call   1060 <MD5@plt>
mov    %r15,%rdi
mov    $0x2690,%esi
mov    %r14,%rdx
call   1070 <SHA1@plt>
lea    0xdd1(%rip),%rdi
call   1040 <printf@plt>
mov    0x0(%r13),%esi
mov    %rbx,%rdi
call   1050 <print_hash@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdb9(%rip),%rdi
call   1040 <printf@plt>
mov    (%r12),%esi
mov    %r14,%rdi
call   1050 <print_hash@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MD5_DIGEST_LENGTH = global i32 0
@SHA_DIGEST_LENGTH = global i32 0
@.str = [10 x i8] c"MD5() = \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [10 x i8] c"SHA1() = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
store i32 1234, i32* %2
store i32 9872, i32* %3
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %4
%9 = alloca double, i64 1234
store i32 0, i32* %5
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 1234
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to double
%16 = fmul double 0x3FBF9ADD3739635F, %15
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %9, i64 %18
store double %16, double* %19
br label %20
20: ; preds = %13
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %10
23: ; preds = %10
%24 = load i32, i32* @MD5_DIGEST_LENGTH
%25 = zext i32 %24 to i64
%26 = alloca i8, i64 %25
store i64 %25, i64* %6
%27 = load i32, i32* @SHA_DIGEST_LENGTH
%28 = zext i32 %27 to i64
%29 = alloca i8, i64 %28
store i64 %28, i64* %7
%30 = bitcast double* %9 to i8*
%31 = call i32 @MD5(i8* %30, i32 9872, i8* %26)
%32 = bitcast double* %9 to i8*
%33 = call i32 @SHA1(i8* %32, i32 9872, i8* %29)
%34 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%35 = load i32, i32* @MD5_DIGEST_LENGTH
%36 = call i32 @print_hash(i8* %26, i32 %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%39 = load i32, i32* @SHA_DIGEST_LENGTH
%40 = call i32 @print_hash(i8* %29, i32 %39)
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
%42 = load i8*, i8** %4
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@MD5_DIGEST_LENGTH = global i32 0
@SHA_DIGEST_LENGTH = global i32 0
@.str = [10 x i8] c"MD5() = \00"
@.str.2 = [10 x i8] c"SHA1() = \00"
define i32 @main() {
%1 = alloca [1234 x double]
br label %2
2: ; preds = %2, %0
%3 = phi i64 [ 0, %0 ], [ %25, %2 ]
%4 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %26, %2 ]
%5 = add <2 x i32> %4, <i32 2, i32 2>
%6 = sitofp <2 x i32> %4 to <2 x double>
%7 = sitofp <2 x i32> %5 to <2 x double>
%8 = fmul <2 x double> %6, <double 0x3FBF9ADD3739635F, double 0x3FBF9ADD3739635F>
%9 = fmul <2 x double> %7, <double 0x3FBF9ADD3739635F, double 0x3FBF9ADD3739635F>
%10 = getelementptr inbounds [1234 x double], [1234 x double]* %1, i64 0, i64 %3
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> %8, <2 x double>* %11
%12 = getelementptr inbounds double, double* %10, i64 2
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> %9, <2 x double>* %13
%14 = or i64 %3, 4
%15 = add <2 x i32> %4, <i32 4, i32 4>
%16 = add <2 x i32> %4, <i32 6, i32 6>
%17 = sitofp <2 x i32> %15 to <2 x double>
%18 = sitofp <2 x i32> %16 to <2 x double>
%19 = fmul <2 x double> %17, <double 0x3FBF9ADD3739635F, double 0x3FBF9ADD3739635F>
%20 = fmul <2 x double> %18, <double 0x3FBF9ADD3739635F, double 0x3FBF9ADD3739635F>
%21 = getelementptr inbounds [1234 x double], [1234 x double]* %1, i64 0, i64 %14
%22 = bitcast double* %21 to <2 x double>*
store <2 x double> %19, <2 x double>* %22
%23 = getelementptr inbounds double, double* %21, i64 2
%24 = bitcast double* %23 to <2 x double>*
store <2 x double> %20, <2 x double>* %24
%25 = add nuw nsw i64 %3, 8
%26 = add <2 x i32> %4, <i32 8, i32 8>
%27 = icmp eq i64 %25, 1232
br i1 %27, label %28, label %2
28: ; preds = %2
%29 = getelementptr inbounds [1234 x double], [1234 x double]* %1, i64 0, i64 1232
store double 0x40630329133885C7, double* %29
%30 = getelementptr inbounds [1234 x double], [1234 x double]* %1, i64 0, i64 1233
store double 0x4063071C6EDF6CF4, double* %30
%31 = load i32, i32* @MD5_DIGEST_LENGTH
%32 = zext i32 %31 to i64
%33 = alloca i8, i64 %32
%34 = load i32, i32* @SHA_DIGEST_LENGTH
%35 = zext i32 %34 to i64
%36 = alloca i8, i64 %35
%37 = bitcast [1234 x double]* %1 to i8*
%38 = call i32 @MD5(i8* %37, i32 9872, i8* %33)
%39 = call i32 @SHA1(i8* %37, i32 9872, i8* %36)
%40 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%41 = load i32, i32* @MD5_DIGEST_LENGTH
%42 = call i32 @print_hash(i8* %33, i32 %41)
%43 = call i32 @putchar(i32 10)
%44 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* @SHA_DIGEST_LENGTH
%46 = call i32 @print_hash(i8* %36, i32 %45)
%47 = call i32 @putchar(i32 10)
ret i32 0
}