#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*/ dat;
typedef int /*<<< orphan*/ MD5_CTX;

/* Variables and functions */
int MD5_DIGEST_LENGTH;
int /*<<< orphan*/ MD5_Final(unsigned char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ MD5_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ MD5_Update(int /*<<< orphan*/ *, unsigned char *, int);
int /*<<< orphan*/ SHA1(unsigned char *, int, unsigned char *);
int SHA_DIGEST_LENGTH;
int main(void) {
  MD5_CTX context;
  unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
  unsigned char dat[] = "12345";
  MD5_Init(&context);
  MD5_Update(&context, &dat[0], sizeof(dat));
  MD5_Final(&md[0], &context);
  SHA1(&dat[0], sizeof(dat), &md[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    0x2e89(%rip),%rcx
mov    (%rcx),%ecx
add    %ecx,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    0xe74(%rip),%eax
mov    %eax,-0x1e(%rbp)
mov    0xe6e(%rip),%ax
mov    %ax,-0x1a(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <MD5_Init@plt>
lea    -0x1e(%rbp),%rsi
lea    -0x8(%rbp),%rdi
mov    $0x6,%edx
call   1060 <MD5_Update@plt>
mov    -0x28(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <MD5_Final@plt>
mov    -0x28(%rbp),%rdx
lea    -0x1e(%rbp),%rdi
mov    $0x6,%esi
call   1040 <SHA1@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%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   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%r12
mov    0x2e7f(%rip),%rax
mov    0x2e88(%rip),%rcx
mov    (%rcx),%ecx
add    (%rax),%ecx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rbx
sub    %rcx,%rbx
mov    %rbx,%rsp
movw   $0x35,-0x24(%rbp)
movl   $0x34333231,-0x28(%rbp)
lea    -0x2c(%rbp),%r14
mov    %r14,%rdi
call   1050 <MD5_Init@plt>
lea    -0x28(%rbp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x6,%edx
call   1060 <MD5_Update@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <MD5_Final@plt>
mov    %r15,%rdi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <SHA1@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MD5_DIGEST_LENGTH = global i32 0
@SHA_DIGEST_LENGTH = global i32 0
@__const.main.dat = [6 x i8] c"12345\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [6 x i8]
store i32 0, i32* %1
%6 = load i32, i32* @MD5_DIGEST_LENGTH
%7 = load i32, i32* @SHA_DIGEST_LENGTH
%8 = add nsw i32 %6, %7
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i8, i64 %9
store i64 %9, i64* %4
%12 = bitcast [6 x i8]* %5 to i8*
%13 = call i32 @MD5_Init(i32* %2)
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%15 = call i32 @MD5_Update(i32* %2, i8* %14, i32 6)
%16 = getelementptr inbounds i8, i8* %11, i64 0
%17 = call i32 @MD5_Final(i8* %16, i32* %2)
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%19 = getelementptr inbounds i8, i8* %11, i64 0
%20 = call i32 @SHA1(i8* %18, i32 6, i8* %19)
store i32 0, i32* %1
%21 = load i8*, i8** %3
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@MD5_DIGEST_LENGTH = global i32 0
@SHA_DIGEST_LENGTH = global i32 0
@__const.main.dat = [6 x i8] c"12345\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = bitcast i32* %1 to i8*
%4 = load i32, i32* @MD5_DIGEST_LENGTH
%5 = load i32, i32* @SHA_DIGEST_LENGTH
%6 = add nsw i32 %5, %4
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%11 = call i32 @MD5_Init(i32* %1)
%12 = call i32 @MD5_Update(i32* %1, i8* %10, i32 6)
%13 = call i32 @MD5_Final(i8* %9, i32* %1)
%14 = call i32 @SHA1(i8* %10, i32 6, i8* %9)
ret i32 0
}