#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 */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dump_time_struct_bytes(struct tm *time_ptr, int size) {
  int i;
  unsigned char *raw_ptr;
  printf("bytes of struct located at %p\n", (void *)time_ptr);
  raw_ptr = (unsigned char *)time_ptr;
  for (i = 0; i < size; i++) {
    printf("%02x ", raw_ptr[i]);
    if (i % 16 == 15)
      printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_time_struct_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119b <dump_time_struct_bytes+0x8b>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0xf,%edx
jne    1188 <dump_time_struct_bytes+0x78>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118d <dump_time_struct_bytes+0x7d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1140 <dump_time_struct_bytes+0x30>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_time_struct_bytes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r15
lea    0xecd(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    117c <dump_time_struct_bytes+0x5c>
mov    %ebp,%ebp
lea    0xed5(%rip),%r14
xor    %ebx,%ebx
jmp    1159 <dump_time_struct_bytes+0x39>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%rbp
je     117c <dump_time_struct_bytes+0x5c>
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0xf,%al
jne    1150 <dump_time_struct_bytes+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <dump_time_struct_bytes+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [31 x i8] c"bytes of struct located at %p\0A\00"
@.str.1 = [6 x i8] c"%02x \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @dump_time_struct_bytes(%struct.tm* %0, i32 %1) {
%3 = alloca %struct.tm*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store %struct.tm* %0, %struct.tm** %3
store i32 %1, i32* %4
%7 = load %struct.tm*, %struct.tm** %3
%8 = bitcast %struct.tm* %7 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load %struct.tm*, %struct.tm** %3
%11 = bitcast %struct.tm* %10 to i8*
store i8* %11, i8** %6
store i32 0, i32* %5
br label %12
12: ; preds = %30, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = load i8*, i8** %6
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %5
%25 = srem i32 %24, 16
%26 = icmp eq i32 %25, 15
br i1 %26, label %27, label %29
27: ; preds = %16
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %16
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %12
33: ; preds = %12
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [31 x i8] c"bytes of struct located at %p\0A\00"
@.str.1 = [6 x i8] c"%02x \00"
define void @dump_time_struct_bytes(%struct.tm* %0, i32 %1) {
%3 = bitcast %struct.tm* %0 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), %struct.tm* %0)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %21
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %18
%9 = phi i64 [ 0, %6 ], [ %19, %18 ]
%10 = getelementptr inbounds i8, i8* %3, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = and i64 %9, 15
%15 = icmp eq i64 %14, 15
br i1 %15, label %16, label %18
16: ; preds = %8
%17 = tail call i32 @putchar(i32 10)
br label %18
18: ; preds = %8, %16
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, %7
br i1 %20, label %21, label %8
21: ; preds = %18, %2
%22 = tail call i32 @putchar(i32 10)
ret void
}