#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 scalar_t__ temp;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_element_data(int num_timesteps, int num_frequencies,
                        int num_elements, int particular_frequency,
                        unsigned char *data) {
  printf("Number of timesteps to print: %d, ", num_timesteps);
  if (particular_frequency == -1)
    printf("number of frequency bands: %d, number of elements: %d\n",
           num_frequencies, num_elements);
  else
    printf("frequency band: %d, number of elements: %d\n", particular_frequency,
           num_elements);
  for (int k = 0; k < num_timesteps; k++) {
    if (num_timesteps > 1) {
      printf("Time Step %d\n", k);
    }
    printf("            ");
    for (int header_i = 0; header_i < num_elements; header_i++) {
      printf("%3dR %3dI ", header_i, header_i);
    }
    printf("\n");
    for (int j = 0; j < num_frequencies; j++) {
      if (particular_frequency == -1 || particular_frequency == j) {
        if (particular_frequency != j)
          printf("Freq: %4d: ", j);
        for (int i = 0; i < num_elements; i++) {
          unsigned char temp =
              data[k * num_frequencies * num_elements + j * num_elements + i];
          printf("%4d %4d ", (int)((((temp) >> 4) & 0x0F)) - 8,
                 (int)(((temp)&0x0F)) - 8);
        }
        printf("\n");
      }
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_element_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xffffffff,-0x10(%rbp)
jne    115c <print_element_data+0x4c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1170 <print_element_data+0x60>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12d3 <print_element_data+0x1c3>
cmpl   $0x1,-0x4(%rbp)
jle    119e <print_element_data+0x8e>
mov    -0x1c(%rbp),%esi
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e1 <print_element_data+0xd1>
mov    -0x20(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b3 <print_element_data+0xa3>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c0 <print_element_data+0x1b0>
cmpl   $0xffffffff,-0x10(%rbp)
je     1218 <print_element_data+0x108>
mov    -0x10(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    12ad <print_element_data+0x19d>
mov    -0x10(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     1235 <print_element_data+0x125>
mov    -0x24(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    129f <print_element_data+0x18f>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
mov    -0x24(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
movzbl -0x29(%rbp),%esi
sar    $0x4,%esi
and    $0xf,%esi
sub    $0x8,%esi
movzbl -0x29(%rbp),%edx
and    $0xf,%edx
sub    $0x8,%edx
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    123c <print_element_data+0x12c>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b2 <print_element_data+0x1a2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f6 <print_element_data+0xe6>
jmp    12c5 <print_element_data+0x1b5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1177 <print_element_data+0x67>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_element_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,0x28(%rsp)
mov    %ecx,%ebx
mov    %edx,%r13d
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xebc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xffffffff,%ebx
je     115d <print_element_data+0x3d>
lea    0xf01(%rip),%rdi
mov    %ebx,%esi
jmp    1167 <print_element_data+0x47>
lea    0xebf(%rip),%rdi
mov    %r14d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    12fc <print_element_data+0x1dc>
mov    %ebx,%eax
mov    %r14d,%ecx
mov    %rcx,0x30(%rsp)
mov    %r13d,%r12d
mov    %r13d,%ecx
imul   %r14d,%ecx
mov    %ecx,0x10(%rsp)
lea    0xf20(%rip),%r15
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
mov    %ebx,0xc(%rsp)
mov    %r13d,0x1c(%rsp)
mov    %r14d,0x18(%rsp)
mov    %ebp,0x14(%rsp)
mov    %rax,0x20(%rsp)
jmp    11f8 <print_element_data+0xd8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%ecx
add    0x10(%rsp),%ecx
mov    %ecx,0x8(%rsp)
mov    0x14(%rsp),%ebp
mov    %edx,0x4(%rsp)
cmp    %ebp,%edx
mov    0x18(%rsp),%r14d
je     12fc <print_element_data+0x1dc>
cmp    $0x1,%ebp
je     120f <print_element_data+0xef>
lea    0xe82(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13d,%r13d
lea    0xe7a(%rip),%rbx
jle    1246 <print_element_data+0x126>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    1230 <print_element_data+0x110>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
mov    0x20(%rsp),%rax
mov    0xc(%rsp),%ebx
jle    11d0 <print_element_data+0xb0>
mov    0x8(%rsp),%ebp
xor    %r14d,%r14d
jmp    129a <print_element_data+0x17a>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ebx
mov    0x1c(%rsp),%r13d
mov    0x20(%rsp),%rax
add    $0x1,%r14
add    %r13d,%ebp
cmp    0x30(%rsp),%r14
je     11d0 <print_element_data+0xb0>
cmp    $0xffffffff,%ebx
je     12a4 <print_element_data+0x184>
cmp    %rax,%r14
jne    1288 <print_element_data+0x168>
cmp    %rax,%r14
je     12ba <print_element_data+0x19a>
lea    0xdfc(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13d,%r13d
jle    1270 <print_element_data+0x150>
movslq %ebp,%r13
add    0x28(%rsp),%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl 0x0(%r13,%rbx,1),%edx
mov    %edx,%esi
shr    $0x4,%esi
add    $0xfffffff8,%esi
and    $0xf,%edx
add    $0xfffffff8,%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    12d0 <print_element_data+0x1b0>
jmp    1270 <print_element_data+0x150>
mov    $0xa,%edi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Number of timesteps to print: %d, \00"
@.str.1 = [55 x i8] c"number of frequency bands: %d, number of elements: %d\0A\00"
@.str.2 = [44 x i8] c"frequency band: %d, number of elements: %d\0A\00"
@.str.3 = [14 x i8] c"Time Step %d\0A\00"
@.str.4 = [13 x i8] c" \00"
@.str.5 = [11 x i8] c"%3dR %3dI \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [12 x i8] c"Freq: %4d: \00"
@.str.8 = [9 x i8] c"%4d %4d \00"
define void @print_element_data(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%16 = load i32, i32* %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %9
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %5
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22)
br label %28
24: ; preds = %5
%25 = load i32, i32* %9
%26 = load i32, i32* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %26)
br label %28
28: ; preds = %24, %20
store i32 0, i32* %11
br label %29
29: ; preds = %113, %28
%30 = load i32, i32* %11
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %116
33: ; preds = %29
%34 = load i32, i32* %6
%35 = icmp sgt i32 %34, 1
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* %11
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %36, %33
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %12
br label %41
41: ; preds = %49, %39
%42 = load i32, i32* %12
%43 = load i32, i32* %8
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %52
45: ; preds = %41
%46 = load i32, i32* %12
%47 = load i32, i32* %12
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %46, i32 %47)
br label %49
49: ; preds = %45
%50 = load i32, i32* %12
%51 = add nsw i32 %50, 1
store i32 %51, i32* %12
br label %41
52: ; preds = %41
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %13
br label %54
54: ; preds = %109, %52
%55 = load i32, i32* %13
%56 = load i32, i32* %7
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %112
58: ; preds = %54
%59 = load i32, i32* %9
%60 = icmp eq i32 %59, -1
br i1 %60, label %65, label %61
61: ; preds = %58
%62 = load i32, i32* %9
%63 = load i32, i32* %13
%64 = icmp eq i32 %62, %63
br i1 %64, label %65, label %108
65: ; preds = %61, %58
%66 = load i32, i32* %9
%67 = load i32, i32* %13
%68 = icmp ne i32 %66, %67
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = load i32, i32* %13
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %69, %65
store i32 0, i32* %14
br label %73
73: ; preds = %103, %72
%74 = load i32, i32* %14
%75 = load i32, i32* %8
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %106
77: ; preds = %73
%78 = load i8*, i8** %10
%79 = load i32, i32* %11
%80 = load i32, i32* %7
%81 = mul nsw i32 %79, %80
%82 = load i32, i32* %8
%83 = mul nsw i32 %81, %82
%84 = load i32, i32* %13
%85 = load i32, i32* %8
%86 = mul nsw i32 %84, %85
%87 = add nsw i32 %83, %86
%88 = load i32, i32* %14
%89 = add nsw i32 %87, %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %78, i64 %90
%92 = load i8, i8* %91
store i8 %92, i8* %15
%93 = load i8, i8* %15
%94 = zext i8 %93 to i32
%95 = ashr i32 %94, 4
%96 = and i32 %95, 15
%97 = sub nsw i32 %96, 8
%98 = load i8, i8* %15
%99 = zext i8 %98 to i32
%100 = and i32 %99, 15
%101 = sub nsw i32 %100, 8
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %97, i32 %101)
br label %103
103: ; preds = %77
%104 = load i32, i32* %14
%105 = add nsw i32 %104, 1
store i32 %105, i32* %14
br label %73
106: ; preds = %73
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %108
108: ; preds = %106, %61
br label %109
109: ; preds = %108
%110 = load i32, i32* %13
%111 = add nsw i32 %110, 1
store i32 %111, i32* %13
br label %54
112: ; preds = %54
br label %113
113: ; preds = %112
%114 = load i32, i32* %11
%115 = add nsw i32 %114, 1
store i32 %115, i32* %11
br label %29
116: ; preds = %29
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Number of timesteps to print: %d, \00"
@.str.1 = [55 x i8] c"number of frequency bands: %d, number of elements: %d\0A\00"
@.str.2 = [44 x i8] c"frequency band: %d, number of elements: %d\0A\00"
@.str.3 = [14 x i8] c"Time Step %d\0A\00"
@.str.4 = [13 x i8] c" \00"
@.str.5 = [11 x i8] c"%3dR %3dI \00"
@.str.7 = [12 x i8] c"Freq: %4d: \00"
@.str.8 = [9 x i8] c"%4d %4d \00"
define void @print_element_data(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture %4) {
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp eq i32 %3, -1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2)
br label %12
10: ; preds = %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %2)
br label %12
12: ; preds = %10, %8
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %21
14: ; preds = %12
%15 = icmp eq i32 %0, 1
%16 = icmp sgt i32 %2, 0
%17 = icmp sgt i32 %1, 0
%18 = zext i32 %3 to i64
%19 = zext i32 %1 to i64
%20 = zext i32 %2 to i64
br label %23
21: ; preds = %38, %12
%22 = tail call i32 @putchar(i32 10)
ret void
23: ; preds = %14, %38
%24 = phi i32 [ 0, %14 ], [ %39, %38 ]
br i1 %15, label %27, label %25
25: ; preds = %23
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %27
27: ; preds = %25, %23
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br i1 %16, label %33, label %29
29: ; preds = %33, %27
%30 = tail call i32 @putchar(i32 10)
br i1 %17, label %31, label %38
31: ; preds = %29
%32 = mul nsw i32 %24, %1
br label %41
33: ; preds = %27, %33
%34 = phi i32 [ %36, %33 ], [ 0, %27 ]
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32 %34)
%36 = add nuw nsw i32 %34, 1
%37 = icmp eq i32 %36, %2
br i1 %37, label %29, label %33
38: ; preds = %70, %29
%39 = add nuw nsw i32 %24, 1
%40 = icmp eq i32 %39, %0
br i1 %40, label %21, label %23
41: ; preds = %31, %70
%42 = phi i64 [ 0, %31 ], [ %71, %70 ]
%43 = icmp eq i64 %42, %18
%44 = select i1 %7, i1 true, i1 %43
br i1 %44, label %45, label %70
45: ; preds = %41
br i1 %43, label %49, label %46
46: ; preds = %45
%47 = trunc i64 %42 to i32
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %46, %45
br i1 %16, label %50, label %55
50: ; preds = %49
%51 = trunc i64 %42 to i32
%52 = add i32 %32, %51
%53 = mul i32 %52, %2
%54 = sext i32 %53 to i64
br label %57
55: ; preds = %57, %49
%56 = tail call i32 @putchar(i32 10)
br label %70
57: ; preds = %50, %57
%58 = phi i64 [ 0, %50 ], [ %68, %57 ]
%59 = add nsw i64 %58, %54
%60 = getelementptr inbounds i8, i8* %4, i64 %59
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = lshr i32 %62, 4
%64 = add nsw i32 %63, -8
%65 = and i32 %62, 15
%66 = add nsw i32 %65, -8
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %64, i32 %66)
%68 = add nuw nsw i64 %58, 1
%69 = icmp eq i64 %68, %20
br i1 %69, label %55, label %57
70: ; preds = %41, %55
%71 = add nuw nsw i64 %42, 1
%72 = icmp eq i64 %71, %19
br i1 %72, label %38, label %41
}