#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*/ hex_dump(char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  int ret = 0;
  int i = 0;
  char *buffer;
  char output[48 * 48] = {0};
  buffer = (char *)malloc(48 * sizeof(char));
  strcpy(buffer, "gkdf");
  while (i < 48) {
    strcat(output, hex_dump(buffer, 16));
    buffer += 16;
    i += 16;
  }
  printf("\nThe \"sensible\" output is:\n%s", output);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x930,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x920(%rbp),%rdi
xor    %esi,%esi
mov    $0x900,%edx
call   1050 <memset@plt>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x30,-0x18(%rbp)
jge    1206 <main+0xa6>
lea    -0x920(%rbp),%rax
mov    %rax,-0x928(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1080 <hex_dump@plt>
mov    -0x928(%rbp),%rdi
mov    %eax,%esi
call   1070 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x18(%rbp)
jmp    11b8 <main+0x58>
lea    -0x920(%rbp),%rsi
lea    0xdf1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x930,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x908,%rsp
mov    %rsp,%r14
mov    $0x900,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe70(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1080 <hex_dump@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <strcat@plt>
lea    0x10(%rbx),%rdi
mov    $0x10,%esi
call   1080 <hex_dump@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <strcat@plt>
add    $0x20,%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   1080 <hex_dump@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <strcat@plt>
lea    0xe1c(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x908,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"gkdf\00"
@.str.1 = [30 x i8] c"\0AThe \22sensible\22 output is:\0A%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [2304 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%10 = bitcast [2304 x i8]* %9 to i8*
%11 = call i64 @malloc(i32 48)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %18, %2
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 48
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = getelementptr inbounds [2304 x i8], [2304 x i8]* %9, i64 0, i64 0
%20 = load i8*, i8** %8
%21 = call i32 @hex_dump(i8* %20, i32 16)
%22 = call i32 @strcat(i8* %19, i32 %21)
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i64 16
store i8* %24, i8** %8
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 16
store i32 %26, i32* %7
br label %15
27: ; preds = %15
%28 = getelementptr inbounds [2304 x i8], [2304 x i8]* %9, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
@.str = [5 x i8] c"gkdf\00"
@.str.1 = [30 x i8] c"\0AThe \22sensible\22 output is:\0A%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2304 x i8]
%4 = getelementptr inbounds [2304 x i8], [2304 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @malloc(i32 48)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @hex_dump(i8* %6, i32 16)
%9 = call i32 @strcat(i8* %4, i32 %8)
%10 = getelementptr inbounds i8, i8* %6, i64 16
%11 = call i32 @hex_dump(i8* %10, i32 16)
%12 = call i32 @strcat(i8* %4, i32 %11)
%13 = getelementptr inbounds i8, i8* %6, i64 32
%14 = call i32 @hex_dump(i8* %13, i32 16)
%15 = call i32 @strcat(i8* %4, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}