#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*/ FILE;

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ strcat(char *, char *);
int bury(char *html, char *secret, int htmlSize, int secretSize) {
  int outputSize = htmlSize + secretSize + 11;
  char *ourSecret = (char *)calloc(outputSize, sizeof(char));
  memset(ourSecret, '\0', outputSize);
  char part1[7] = "<!--;)";
  strcat(ourSecret, part1);
  strcat(ourSecret, secret);
  char part2[6] = "(;-->";
  strcat(ourSecret, part2);
  strcat(ourSecret, html);
  FILE *output = fopen("output.html", "w+");
  int i, character;
  for (i = 0; i < outputSize - 1; i++) {
    character = ourSecret[i];
    fprintf(output, "%c", character);
  }
  fclose(output);
  return outputSize;
}


x86 assembly (clang, -O0):
<bury>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    $0xb,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    0xe59(%rip),%eax
mov    %eax,-0x2f(%rbp)
mov    0xe53(%rip),%ax
mov    %ax,-0x2b(%rbp)
mov    0xe4b(%rip),%al
mov    %al,-0x29(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x2f(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    0xe29(%rip),%eax
mov    %eax,-0x35(%rbp)
mov    0xe23(%rip),%ax
mov    %ax,-0x31(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x35(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcat@plt>
lea    0xe00(%rip),%rdi
lea    0xe05(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1265 <bury+0x105>
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%edx
lea    0xdca(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1224 <bury+0xc4>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bury>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbp
mov    %rdi,%r14
lea    (%rcx,%rdx,1),%r12d
lea    (%rcx,%rdx,1),%r15d
add    $0xb,%r15d
mov    %r15d,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%r13
xor    %ebx,%ebx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r15d,%edx
call   1040 <memset@plt>
movl   $0x293b2d,0x13(%rsp)
movl   $0x2d2d213c,0x10(%rsp)
2d
lea    0x10(%rsp),%rsi
mov    %r13,%rdi
call   1080 <strcat@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
movw   $0x3e,0xc(%rsp)
movl   $0x2d2d3b28,0x8(%rsp)
2d
lea    0x8(%rsp),%rsi
mov    %r13,%rdi
call   1080 <strcat@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xe18(%rip),%rdi
lea    0xe1d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbp
cmp    $0xfffffff7,%r12d
jl     1237 <bury+0xd7>
add    $0x9,%r12d
test   %r12d,%r12d
cmovle %ebx,%r12d
add    $0x1,%r12d
nopl   0x0(%rax)
movsbl 0x0(%r13,%rbx,1),%edi
mov    %rbp,%rsi
call   1050 <fputc@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1220 <bury+0xc0>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.bury.part1 = [7 x i8] c"<!--;)\00"
@__const.bury.part2 = [6 x i8] c"(;-->\00"
@.str = [12 x i8] c"output.html\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @bury(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [7 x i8]
%12 = alloca [6 x i8]
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = add nsw i32 %16, %17
%19 = add nsw i32 %18, 11
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = call i64 @calloc(i32 %20, i32 1)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %10
%23 = load i8*, i8** %10
%24 = load i32, i32* %9
%25 = call i32 @memset(i8* %23, i8 signext 0, i32 %24)
%26 = bitcast [7 x i8]* %11 to i8*
%27 = load i8*, i8** %10
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %11, i64 0, i64 0
%29 = call i32 @strcat(i8* %27, i8* %28)
%30 = load i8*, i8** %10
%31 = load i8*, i8** %6
%32 = call i32 @strcat(i8* %30, i8* %31)
%33 = bitcast [6 x i8]* %12 to i8*
%34 = load i8*, i8** %10
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %12, i64 0, i64 0
%36 = call i32 @strcat(i8* %34, i8* %35)
%37 = load i8*, i8** %10
%38 = load i8*, i8** %5
%39 = call i32 @strcat(i8* %37, i8* %38)
%40 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %13
store i32 0, i32* %14
br label %41
41: ; preds = %56, %4
%42 = load i32, i32* %14
%43 = load i32, i32* %9
%44 = sub nsw i32 %43, 1
%45 = icmp slt i32 %42, %44
br i1 %45, label %46, label %59
46: ; preds = %41
%47 = load i8*, i8** %10
%48 = load i32, i32* %14
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
store i32 %52, i32* %15
%53 = load i32*, i32** %13
%54 = load i32, i32* %15
%55 = call i32 @fprintf(i32* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %46
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
store i32 %58, i32* %14
br label %41
59: ; preds = %41
%60 = load i32*, i32** %13
%61 = call i32 @fclose(i32* %60)
%62 = load i32, i32* %9
ret i32 %62
}

LLVM IR (-O2):
@__const.bury.part1 = [7 x i8] c"<!--;)\00"
@__const.bury.part2 = [6 x i8] c"(;-->\00"
@.str = [12 x i8] c"output.html\00"
@.str.1 = [3 x i8] c"w+\00"
define i32 @bury(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [7 x i8]
%6 = alloca [6 x i8]
%7 = add i32 %3, %2
%8 = add nsw i32 %7, 11
%9 = tail call i64 @calloc(i32 %8, i32 1)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @memset(i8* %10, i8 signext 0, i32 %8)
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%13 = call i32 @strcat(i8* %10, i8* %12)
%14 = call i32 @strcat(i8* %10, i8* %1)
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%16 = call i32 @strcat(i8* %10, i8* %15)
%17 = call i32 @strcat(i8* %10, i8* %0)
%18 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp sgt i32 %7, -10
br i1 %19, label %20, label %33
20: ; preds = %4
%21 = add i32 %7, 9
%22 = call i32 @llvm.smax.i32(i32 %21, i32 0)
%23 = add nuw i32 %22, 1
%24 = zext i32 %23 to i64
br label %25
25: ; preds = %20, %25
%26 = phi i64 [ 0, %20 ], [ %31, %25 ]
%27 = getelementptr inbounds i8, i8* %10, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = call i32 @fputc(i32 %29, i32* %18)
%31 = add nuw nsw i64 %26, 1
%32 = icmp eq i64 %31, %24
br i1 %32, label %33, label %25
33: ; preds = %25, %4
%34 = call i32 @fclose(i32* %18)
ret i32 %8
}