#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*/ testmax(unsigned short *, int /*<<< orphan*/, int);
int /*<<< orphan*/ testmin(unsigned short *, int, int);
int main(void) {
  static unsigned short A[3200] = {
      0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
      0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010,
      0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700,
      0x7ff8, 0x7ff9, 0x7ffa, 0x7ffb, 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff};
  static unsigned short B[3200] = {
      0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700,
      0x7ff8, 0x7ff9, 0x7ffa, 0x7ffb, 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff,
      0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007,
      0x8008, 0x8009, 0x800a, 0x800b, 0x800c, 0x800d, 0x800e, 0x800f};
  static unsigned short C[3200] = {
      0xffff, 0xfffe, 0xfffd, 0xfffc, 0xfffb, 0xfffa, 0xfff9, 0xfff8,
      0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010,
      0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007,
      0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700,
  };
  int i;
  for (i = 32; i < 3200; i++) {
    A[i] = 0x0001;
    B[i] = 0x7000;
    C[i] = 0xffff;
  }
  testmin(A, 10, 1);
  testmin(B, 0x7fff, 0x7000);
  testmin(C, 0x7fff, 0x0009);
  testmax(A, 0, 0x7fff);
  testmax(B, 0, 0x800f);
  testmax(C, 0, 0xffff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x20,-0x8(%rbp)
cmpl   $0xc80,-0x8(%rbp)
jge    1184 <main+0x64>
movslq -0x8(%rbp),%rcx
lea    0x2ef2(%rip),%rax
movw   $0x1,(%rax,%rcx,2)
movslq -0x8(%rbp),%rcx
lea    0x47e1(%rip),%rax
movw   $0x7000,(%rax,%rcx,2)
movslq -0x8(%rbp),%rcx
lea    0x60d0(%rip),%rax
movw   $0xffff,(%rax,%rcx,2)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
lea    0x2eb5(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1040 <testmin@plt>
lea    0x479f(%rip),%rdi
mov    $0x7fff,%esi
mov    $0x7000,%edx
call   1040 <testmin@plt>
lea    0x6089(%rip),%rdi
mov    $0x7fff,%esi
mov    $0x9,%edx
call   1040 <testmin@plt>
lea    0x2e73(%rip),%rdi
xor    %esi,%esi
mov    $0x7fff,%edx
call   1030 <testmax@plt>
lea    0x4760(%rip),%rdi
xor    %esi,%esi
mov    $0x800f,%edx
call   1030 <testmax@plt>
lea    0x604d(%rip),%rdi
xor    %esi,%esi
mov    $0xffff,%edx
call   1030 <testmax@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0x6144(%rip),%rdi
mov    $0x18c0,%edx
mov    $0xff,%esi
call   1030 <memset@plt>
mov    $0x48,%eax
lea    0x2ee9(%rip),%rcx
movaps 0xea2(%rip),%xmm0
lea    0x47db(%rip),%rdx
movaps 0xea4(%rip),%xmm1
nopl   0x0(%rax)
movaps %xmm0,-0x50(%rcx,%rax,2)
movaps %xmm0,-0x40(%rcx,%rax,2)
movaps %xmm1,-0x50(%rdx,%rax,2)
movaps %xmm1,-0x40(%rdx,%rax,2)
movaps %xmm0,-0x30(%rcx,%rax,2)
movaps %xmm0,-0x20(%rcx,%rax,2)
movaps %xmm1,-0x30(%rdx,%rax,2)
movaps %xmm1,-0x20(%rdx,%rax,2)
movaps %xmm0,-0x10(%rcx,%rax,2)
movaps %xmm0,(%rcx,%rax,2)
movaps %xmm1,-0x10(%rdx,%rax,2)
movaps %xmm1,(%rdx,%rax,2)
add    $0x30,%rax
cmp    $0xca8,%rax
jne    1170 <main+0x40>
lea    0x2e83(%rip),%r14
mov    %r14,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1050 <testmin@plt>
lea    0x476a(%rip),%r15
mov    %r15,%rdi
mov    $0x7fff,%esi
mov    $0x7000,%edx
call   1050 <testmin@plt>
lea    0x6051(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7fff,%esi
mov    $0x9,%edx
call   1050 <testmin@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x7fff,%edx
call   1040 <testmax@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x800f,%edx
call   1040 <testmax@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xffff,%edx
call   1040 <testmax@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@main.A = internal global <{ [32 x i16], [3168 x i16] }> <{ [32 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 28672, i16 28928, i16 29184, i16 29440, i16 29696, i16 29952, i16 30208, i16 30464, i16 32760, i16 32761, i16 32762, i16 32763, i16 32764, i16 32765, i16 32766, i16 32767], [3168 x i16] zeroinitializer }>
@main.B = internal global <{ [32 x i16], [3168 x i16] }> <{ [32 x i16] [i16 28672, i16 28928, i16 29184, i16 29440, i16 29696, i16 29952, i16 30208, i16 30464, i16 32760, i16 32761, i16 32762, i16 32763, i16 32764, i16 32765, i16 32766, i16 32767, i16 -32768, i16 -32767, i16 -32766, i16 -32765, i16 -32764, i16 -32763, i16 -32762, i16 -32761, i16 -32760, i16 -32759, i16 -32758, i16 -32757, i16 -32756, i16 -32755, i16 -32754, i16 -32753], [3168 x i16] zeroinitializer }>
@main.C = internal global <{ [32 x i16], [3168 x i16] }> <{ [32 x i16] [i16 -1, i16 -2, i16 -3, i16 -4, i16 -5, i16 -6, i16 -7, i16 -8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 -32768, i16 -32767, i16 -32766, i16 -32765, i16 -32764, i16 -32763, i16 -32762, i16 -32761, i16 28672, i16 28928, i16 29184, i16 29440, i16 29696, i16 29952, i16 30208, i16 30464], [3168 x i16] zeroinitializer }>
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 32, i32* %2
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 3200
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.A to [3200 x i16]*), i64 0, i64 %8
store i16 1, i16* %9
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.B to [3200 x i16]*), i64 0, i64 %11
store i16 28672, i16* %12
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.C to [3200 x i16]*), i64 0, i64 %14
store i16 -1, i16* %15
br label %16
16: ; preds = %6
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %3
19: ; preds = %3
%20 = call i32 @testmin(i16* getelementptr inbounds ([3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.A to [3200 x i16]*), i64 0, i64 0), i32 10, i32 1)
%21 = call i32 @testmin(i16* getelementptr inbounds ([3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.B to [3200 x i16]*), i64 0, i64 0), i32 32767, i32 28672)
%22 = call i32 @testmin(i16* getelementptr inbounds ([3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.C to [3200 x i16]*), i64 0, i64 0), i32 32767, i32 9)
%23 = call i32 @testmax(i16* getelementptr inbounds ([3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.A to [3200 x i16]*), i64 0, i64 0), i32 0, i32 32767)
%24 = call i32 @testmax(i16* getelementptr inbounds ([3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.B to [3200 x i16]*), i64 0, i64 0), i32 0, i32 32783)
%25 = call i32 @testmax(i16* getelementptr inbounds ([3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.C to [3200 x i16]*), i64 0, i64 0), i32 0, i32 65535)
ret i32 0
}

LLVM IR (-O2):
@main.A = internal global <{ [32 x i16], [3168 x i16] }> <{ [32 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 28672, i16 28928, i16 29184, i16 29440, i16 29696, i16 29952, i16 30208, i16 30464, i16 32760, i16 32761, i16 32762, i16 32763, i16 32764, i16 32765, i16 32766, i16 32767], [3168 x i16] zeroinitializer }>
@main.B = internal global <{ [32 x i16], [3168 x i16] }> <{ [32 x i16] [i16 28672, i16 28928, i16 29184, i16 29440, i16 29696, i16 29952, i16 30208, i16 30464, i16 32760, i16 32761, i16 32762, i16 32763, i16 32764, i16 32765, i16 32766, i16 32767, i16 -32768, i16 -32767, i16 -32766, i16 -32765, i16 -32764, i16 -32763, i16 -32762, i16 -32761, i16 -32760, i16 -32759, i16 -32758, i16 -32757, i16 -32756, i16 -32755, i16 -32754, i16 -32753], [3168 x i16] zeroinitializer }>
@main.C = internal global <{ [32 x i16], [3168 x i16] }> <{ [32 x i16] [i16 -1, i16 -2, i16 -3, i16 -4, i16 -5, i16 -6, i16 -7, i16 -8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 -32768, i16 -32767, i16 -32766, i16 -32765, i16 -32764, i16 -32763, i16 -32762, i16 -32761, i16 28672, i16 28928, i16 29184, i16 29440, i16 29696, i16 29952, i16 30208, i16 30464], [3168 x i16] zeroinitializer }>
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %30, %1 ]
%3 = add nuw nsw i64 %2, 32
%4 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.A to [3200 x i16]*), i64 0, i64 %3
%5 = bitcast i16* %4 to <8 x i16>*
store <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>* %5
%6 = getelementptr inbounds i16, i16* %4, i64 8
%7 = bitcast i16* %6 to <8 x i16>*
store <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>* %7
%8 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.B to [3200 x i16]*), i64 0, i64 %3
%9 = bitcast i16* %8 to <8 x i16>*
store <8 x i16> <i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672>, <8 x i16>* %9
%10 = getelementptr inbounds i16, i16* %8, i64 8
%11 = bitcast i16* %10 to <8 x i16>*
store <8 x i16> <i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672>, <8 x i16>* %11
%12 = add nuw nsw i64 %2, 48
%13 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.A to [3200 x i16]*), i64 0, i64 %12
%14 = bitcast i16* %13 to <8 x i16>*
store <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>* %14
%15 = getelementptr inbounds i16, i16* %13, i64 8
%16 = bitcast i16* %15 to <8 x i16>*
store <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>* %16
%17 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.B to [3200 x i16]*), i64 0, i64 %12
%18 = bitcast i16* %17 to <8 x i16>*
store <8 x i16> <i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672>, <8 x i16>* %18
%19 = getelementptr inbounds i16, i16* %17, i64 8
%20 = bitcast i16* %19 to <8 x i16>*
store <8 x i16> <i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672>, <8 x i16>* %20
%21 = add nuw nsw i64 %2, 64
%22 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.A to [3200 x i16]*), i64 0, i64 %21
%23 = bitcast i16* %22 to <8 x i16>*
store <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>* %23
%24 = getelementptr inbounds i16, i16* %22, i64 8
%25 = bitcast i16* %24 to <8 x i16>*
store <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16>* %25
%26 = getelementptr inbounds [3200 x i16], [3200 x i16]* bitcast (<{ [32 x i16], [3168 x i16] }>* @main.B to [3200 x i16]*), i64 0, i64 %21
%27 = bitcast i16* %26 to <8 x i16>*
store <8 x i16> <i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672>, <8 x i16>* %27
%28 = getelementptr inbounds i16, i16* %26, i64 8
%29 = bitcast i16* %28 to <8 x i16>*
store <8 x i16> <i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672, i16 28672>, <8 x i16>* %29
%30 = add nuw nsw i64 %2, 48
%31 = icmp eq i64 %30, 3168
br i1 %31, label %32, label %1
32: ; preds = %1
%33 = tail call i32 @testmin(i16* getelementptr inbounds (<{ [32 x i16], [3168 x i16] }>, <{ [32 x i16], [3168 x i16] }>* @main.A, i64 0, i32 0, i64 0), i32 10, i32 1)
%34 = tail call i32 @testmin(i16* getelementptr inbounds (<{ [32 x i16], [3168 x i16] }>, <{ [32 x i16], [3168 x i16] }>* @main.B, i64 0, i32 0, i64 0), i32 32767, i32 28672)
%35 = tail call i32 @testmin(i16* getelementptr inbounds (<{ [32 x i16], [3168 x i16] }>, <{ [32 x i16], [3168 x i16] }>* @main.C, i64 0, i32 0, i64 0), i32 32767, i32 9)
%36 = tail call i32 @testmax(i16* getelementptr inbounds (<{ [32 x i16], [3168 x i16] }>, <{ [32 x i16], [3168 x i16] }>* @main.A, i64 0, i32 0, i64 0), i32 0, i32 32767)
%37 = tail call i32 @testmax(i16* getelementptr inbounds (<{ [32 x i16], [3168 x i16] }>, <{ [32 x i16], [3168 x i16] }>* @main.B, i64 0, i32 0, i64 0), i32 0, i32 32783)
%38 = tail call i32 @testmax(i16* getelementptr inbounds (<{ [32 x i16], [3168 x i16] }>, <{ [32 x i16], [3168 x i16] }>* @main.C, i64 0, i32 0, i64 0), i32 0, i32 65535)
ret i32 0
}