#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 rand();
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ strcpy(char *const, char *);
scalar_t__ time(int /*<<< orphan*/ *);
void smtp_gen_mime_boundary(char *const boundary) {
  size_t i;
  unsigned int seed;
  seed = (unsigned int)time(NULL);
  srand(seed);
  strcpy(boundary, "mime");
  for (i = 4; i < 15 - 1; i++) {
    boundary[i] = rand() % 26 + 'A';
  }
  boundary[15 - 1] = '\0';
}


x86 assembly (clang, -O0):
<smtp_gen_mime_boundary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <srand@plt>
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcpy@plt>
movq   $0x4,-0x10(%rbp)
cmpq   $0xe,-0x10(%rbp)
jae    11b1 <smtp_gen_mime_boundary+0x71>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <smtp_gen_mime_boundary+0x38>
mov    -0x8(%rbp),%rax
movb   $0x0,0xe(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smtp_gen_mime_boundary>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0x4(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0x5(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0x6(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0x7(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0x8(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0x9(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0xa(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0xb(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0xc(%rbx)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
mov    %al,0xd(%rbx)
movb   $0x0,0xe(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"mime\00"
define void @smtp_gen_mime_boundary(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @srand(i32 %7)
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i64 4, i64* %3
br label %11
11: ; preds = %22, %1
%12 = load i64, i64* %3
%13 = icmp ult i64 %12, 14
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 26
%17 = add nsw i32 %16, 65
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %2
%20 = load i64, i64* %3
%21 = getelementptr inbounds i8, i8* %19, i64 %20
store i8 %18, i8* %21
br label %22
22: ; preds = %14
%23 = load i64, i64* %3
%24 = add i64 %23, 1
store i64 %24, i64* %3
br label %11
25: ; preds = %11
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 14
store i8 0, i8* %27
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"mime\00"
define void @smtp_gen_mime_boundary(i8* %0) {
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 26
%8 = trunc i32 %7 to i8
%9 = add nsw i8 %8, 65
%10 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %9, i8* %10
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 26
%13 = trunc i32 %12 to i8
%14 = add nsw i8 %13, 65
%15 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %14, i8* %15
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 26
%18 = trunc i32 %17 to i8
%19 = add nsw i8 %18, 65
%20 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %19, i8* %20
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 26
%23 = trunc i32 %22 to i8
%24 = add nsw i8 %23, 65
%25 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %24, i8* %25
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, 26
%28 = trunc i32 %27 to i8
%29 = add nsw i8 %28, 65
%30 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %29, i8* %30
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 26
%33 = trunc i32 %32 to i8
%34 = add nsw i8 %33, 65
%35 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %34, i8* %35
%36 = tail call i32 (...) @rand()
%37 = srem i32 %36, 26
%38 = trunc i32 %37 to i8
%39 = add nsw i8 %38, 65
%40 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %39, i8* %40
%41 = tail call i32 (...) @rand()
%42 = srem i32 %41, 26
%43 = trunc i32 %42 to i8
%44 = add nsw i8 %43, 65
%45 = getelementptr inbounds i8, i8* %0, i64 11
store i8 %44, i8* %45
%46 = tail call i32 (...) @rand()
%47 = srem i32 %46, 26
%48 = trunc i32 %47 to i8
%49 = add nsw i8 %48, 65
%50 = getelementptr inbounds i8, i8* %0, i64 12
store i8 %49, i8* %50
%51 = tail call i32 (...) @rand()
%52 = srem i32 %51, 26
%53 = trunc i32 %52 to i8
%54 = add nsw i8 %53, 65
%55 = getelementptr inbounds i8, i8* %0, i64 13
store i8 %54, i8* %55
%56 = getelementptr inbounds i8, i8* %0, i64 14
store i8 0, i8* %56
ret void
}