#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*/ my_printf(char *, unsigned short);
int /*<<< orphan*/ print_timer();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stop();
int main(void) {
  unsigned short int data[16] = {12,  15, 20, 210, 124, 16, 54, 156,
                                 134, 21, 7,  15,  46,  97, 84, 161};
  unsigned int i;
  print_timer();
  print_timer();
  print_timer();
  unsigned int max = 0;
  unsigned int min = 255;
  unsigned int beta;
  while (!(*(volatile unsigned int *)(0x30000000))) {
    int value = (*(volatile unsigned int *)(0x30000080));
    *(volatile unsigned int *)(0x30000090) = (value);
  }
  for (i = 0; i < 16; i++) {
    my_printf(" val=> ", data[i]);
  }
  print_timer();
  for (i = 0; i < 16; i++) {
    if (data[i] > max)
      max = data[i];
    if (data[i] < min)
      min = data[i];
  }
  beta = 255 << 8;
  beta = beta / (max - min);
  for (i = 0; i < 16; i++) {
    data[i] = (beta * (data[i] - min)) >> 8;
  }
  print_timer();
  for (i = 0; i < 16; i++) {
    my_printf(" val=> ", data[i]);
  }
  print_timer();
  puts("MAIN FINISHED\n");
  stop();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <print_timer@plt>
mov    $0x0,%al
call   1030 <print_timer@plt>
mov    $0x0,%al
call   1030 <print_timer@plt>
movl   $0x0,-0x38(%rbp)
movl   $0xff,-0x3c(%rbp)
mov    $0x30000000,%eax
mov    (%rax),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ba <main+0x7a>
jmp    11d3 <main+0x93>
mov    $0x30000080,%eax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
mov    $0x30000090,%eax
mov    %ecx,(%rax)
jmp    119e <main+0x5e>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jae    1206 <main+0xc6>
mov    -0x34(%rbp),%eax
lea    0xe32(%rip),%rdi
movzwl -0x30(%rbp,%rax,2),%esi
call   1060 <my_printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11da <main+0x9a>
mov    $0x0,%al
call   1030 <print_timer@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jae    1269 <main+0x129>
mov    -0x34(%rbp),%eax
movzwl -0x30(%rbp,%rax,2),%eax
cmp    -0x38(%rbp),%eax
jbe    123a <main+0xfa>
mov    -0x34(%rbp),%eax
movzwl -0x30(%rbp,%rax,2),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
movzwl -0x30(%rbp,%rax,2),%eax
cmp    -0x3c(%rbp),%eax
jae    1256 <main+0x116>
mov    -0x34(%rbp),%eax
movzwl -0x30(%rbp,%rax,2),%eax
mov    %eax,-0x3c(%rbp)
jmp    125b <main+0x11b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1214 <main+0xd4>
movl   $0xff00,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jae    12be <main+0x17e>
mov    -0x40(%rbp),%eax
mov    -0x34(%rbp),%ecx
movzwl -0x30(%rbp,%rcx,2),%ecx
sub    -0x3c(%rbp),%ecx
imul   %ecx,%eax
shr    $0x8,%eax
mov    %ax,%cx
mov    -0x34(%rbp),%eax
mov    %cx,-0x30(%rbp,%rax,2)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1287 <main+0x147>
mov    $0x0,%al
call   1030 <print_timer@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jae    12f8 <main+0x1b8>
mov    -0x34(%rbp),%eax
lea    0xd40(%rip),%rdi
movzwl -0x30(%rbp,%rax,2),%esi
call   1060 <my_printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12cc <main+0x18c>
mov    $0x0,%al
call   1030 <print_timer@plt>
lea    0xd22(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1050 <stop@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <print_timer@plt>
xor    %eax,%eax
call   1030 <print_timer@plt>
xor    %eax,%eax
call   1030 <print_timer@plt>
cmpl   $0x0,0x30000000
jne    1178 <main+0x38>
mov    0x30000080,%eax
mov    %eax,0x30000090
cmpl   $0x0,0x30000000
je     1160 <main+0x20>
lea    0xe81(%rip),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xd2,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x36,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x9c,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x86,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x15,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x54,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xa1,%esi
call   1060 <my_printf@plt>
xor    %eax,%eax
call   1030 <print_timer@plt>
xor    %eax,%eax
call   1030 <print_timer@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xfe,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x92,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xba,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x9f,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x70,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0x60,%esi
call   1060 <my_printf@plt>
mov    %rbx,%rdi
mov    $0xc1,%esi
call   1060 <my_printf@plt>
xor    %eax,%eax
call   1030 <print_timer@plt>
lea    0xcd0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <stop@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.data = [16 x i16] [i16 12, i16 15, i16 20, i16 210, i16 124, i16 16, i16 54, i16 156, i16 134, i16 21, i16 7, i16 15, i16 46, i16 97, i16 84, i16 161]
@.str = [8 x i8] c" val=> \00"
@.str.1 = [15 x i8] c"MAIN FINISHED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i16]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [16 x i16]* %2 to i8*
%9 = call i32 (...) @print_timer()
%10 = call i32 (...) @print_timer()
%11 = call i32 (...) @print_timer()
store i32 0, i32* %4
store i32 255, i32* %5
br label %12
12: ; preds = %16, %0
%13 = load volatile i32, i32* inttoptr (i64 805306368 to i32*)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store i32 %17, i32* %7
%18 = load i32, i32* %7
store volatile i32 %18, i32* inttoptr (i64 805306512 to i32*)
br label %12
19: ; preds = %12
store i32 0, i32* %3
br label %20
20: ; preds = %29, %19
%21 = load i32, i32* %3
%22 = icmp ult i32 %21, 16
br i1 %22, label %23, label %32
23: ; preds = %20
%24 = load i32, i32* %3
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %25
%27 = load i16, i16* %26
%28 = call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext %27)
br label %29
29: ; preds = %23
%30 = load i32, i32* %3
%31 = add i32 %30, 1
store i32 %31, i32* %3
br label %20
32: ; preds = %20
%33 = call i32 (...) @print_timer()
store i32 0, i32* %3
br label %34
34: ; preds = %66, %32
%35 = load i32, i32* %3
%36 = icmp ult i32 %35, 16
br i1 %36, label %37, label %69
37: ; preds = %34
%38 = load i32, i32* %3
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %39
%41 = load i16, i16* %40
%42 = zext i16 %41 to i32
%43 = load i32, i32* %4
%44 = icmp ugt i32 %42, %43
br i1 %44, label %45, label %51
45: ; preds = %37
%46 = load i32, i32* %3
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %47
%49 = load i16, i16* %48
%50 = zext i16 %49 to i32
store i32 %50, i32* %4
br label %51
51: ; preds = %45, %37
%52 = load i32, i32* %3
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %53
%55 = load i16, i16* %54
%56 = zext i16 %55 to i32
%57 = load i32, i32* %5
%58 = icmp ult i32 %56, %57
br i1 %58, label %59, label %65
59: ; preds = %51
%60 = load i32, i32* %3
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %61
%63 = load i16, i16* %62
%64 = zext i16 %63 to i32
store i32 %64, i32* %5
br label %65
65: ; preds = %59, %51
br label %66
66: ; preds = %65
%67 = load i32, i32* %3
%68 = add i32 %67, 1
store i32 %68, i32* %3
br label %34
69: ; preds = %34
store i32 65280, i32* %6
%70 = load i32, i32* %6
%71 = load i32, i32* %4
%72 = load i32, i32* %5
%73 = sub i32 %71, %72
%74 = udiv i32 %70, %73
store i32 %74, i32* %6
store i32 0, i32* %3
br label %75
75: ; preds = %93, %69
%76 = load i32, i32* %3
%77 = icmp ult i32 %76, 16
br i1 %77, label %78, label %96
78: ; preds = %75
%79 = load i32, i32* %6
%80 = load i32, i32* %3
%81 = zext i32 %80 to i64
%82 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %81
%83 = load i16, i16* %82
%84 = zext i16 %83 to i32
%85 = load i32, i32* %5
%86 = sub i32 %84, %85
%87 = mul i32 %79, %86
%88 = lshr i32 %87, 8
%89 = trunc i32 %88 to i16
%90 = load i32, i32* %3
%91 = zext i32 %90 to i64
%92 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %91
store i16 %89, i16* %92
br label %93
93: ; preds = %78
%94 = load i32, i32* %3
%95 = add i32 %94, 1
store i32 %95, i32* %3
br label %75
96: ; preds = %75
%97 = call i32 (...) @print_timer()
store i32 0, i32* %3
br label %98
98: ; preds = %107, %96
%99 = load i32, i32* %3
%100 = icmp ult i32 %99, 16
br i1 %100, label %101, label %110
101: ; preds = %98
%102 = load i32, i32* %3
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds [16 x i16], [16 x i16]* %2, i64 0, i64 %103
%105 = load i16, i16* %104
%106 = call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext %105)
br label %107
107: ; preds = %101
%108 = load i32, i32* %3
%109 = add i32 %108, 1
store i32 %109, i32* %3
br label %98
110: ; preds = %98
%111 = call i32 (...) @print_timer()
%112 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%113 = call i32 (...) @stop()
%114 = load i32, i32* %1
ret i32 %114
}

LLVM IR (-O2):
@.str = [8 x i8] c" val=> \00"
@.str.1 = [15 x i8] c"MAIN FINISHED\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @print_timer()
%2 = tail call i32 (...) @print_timer()
%3 = tail call i32 (...) @print_timer()
%4 = load volatile i32, i32* inttoptr (i64 805306368 to i32*)
%5 = icmp eq i32 %4, 0
br i1 %5, label %44, label %6
6: ; preds = %44, %0
%7 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 12)
%8 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 15)
%9 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 20)
%10 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 210)
%11 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 124)
%12 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 16)
%13 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 54)
%14 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 156)
%15 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 134)
%16 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 21)
%17 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 7)
%18 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 15)
%19 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 46)
%20 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 97)
%21 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 84)
%22 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 161)
%23 = tail call i32 (...) @print_timer()
%24 = tail call i32 (...) @print_timer()
%25 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 6)
%26 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 10)
%27 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 16)
%28 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 254)
%29 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 146)
%30 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 11)
%31 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 58)
%32 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 186)
%33 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 159)
%34 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 17)
%35 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 0)
%36 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 10)
%37 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 48)
%38 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 112)
%39 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 96)
%40 = tail call i32 @my_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i16 zeroext 193)
%41 = tail call i32 (...) @print_timer()
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%43 = tail call i32 (...) @stop()
ret i32 0
44: ; preds = %0, %44
%45 = load volatile i32, i32* inttoptr (i64 805306496 to i32*)
store volatile i32 %45, i32* inttoptr (i64 805306512 to i32*)
%46 = load volatile i32, i32* inttoptr (i64 805306368 to i32*)
%47 = icmp eq i32 %46, 0
br i1 %47, label %44, label %6
}