#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 const *, int /*<<< orphan*/, int);
int /*<<< orphan*/ testmin(unsigned short const *, int, int);
int main(void) {
  static unsigned short const A[32] = {
      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 const B[32] = {
      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 const C[32] = {
      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,
  };
  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)
lea    0xeca(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1040 <testmin@plt>
lea    0xef4(%rip),%rdi
mov    $0x7fff,%esi
mov    $0x7000,%edx
call   1040 <testmin@plt>
lea    0xf1e(%rip),%rdi
mov    $0x7fff,%esi
mov    $0x9,%edx
call   1040 <testmin@plt>
lea    0xe88(%rip),%rdi
xor    %esi,%esi
mov    $0x7fff,%edx
call   1030 <testmax@plt>
lea    0xeb5(%rip),%rdi
xor    %esi,%esi
mov    $0x800f,%edx
call   1030 <testmax@plt>
lea    0xee2(%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    0xed4(%rip),%r14
mov    %r14,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1040 <testmin@plt>
lea    0xefb(%rip),%r15
mov    %r15,%rdi
mov    $0x7fff,%esi
mov    $0x7000,%edx
call   1040 <testmin@plt>
lea    0xf22(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7fff,%esi
mov    $0x9,%edx
call   1040 <testmin@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x7fff,%edx
call   1030 <testmax@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x800f,%edx
call   1030 <testmax@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xffff,%edx
call   1030 <testmax@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@main.A = internal constant [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]
@main.B = internal constant [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]
@main.C = internal constant [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]
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @testmin(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.A, i64 0, i64 0), i32 10, i32 1)
%3 = call i32 @testmin(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.B, i64 0, i64 0), i32 32767, i32 28672)
%4 = call i32 @testmin(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.C, i64 0, i64 0), i32 32767, i32 9)
%5 = call i32 @testmax(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.A, i64 0, i64 0), i32 0, i32 32767)
%6 = call i32 @testmax(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.B, i64 0, i64 0), i32 0, i32 32783)
%7 = call i32 @testmax(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.C, i64 0, i64 0), i32 0, i32 65535)
ret i32 0
}

LLVM IR (-O2):
@main.A = internal constant [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]
@main.B = internal constant [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]
@main.C = internal constant [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]
define i32 @main() {
%1 = tail call i32 @testmin(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.A, i64 0, i64 0), i32 10, i32 1)
%2 = tail call i32 @testmin(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.B, i64 0, i64 0), i32 32767, i32 28672)
%3 = tail call i32 @testmin(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.C, i64 0, i64 0), i32 32767, i32 9)
%4 = tail call i32 @testmax(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.A, i64 0, i64 0), i32 0, i32 32767)
%5 = tail call i32 @testmax(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.B, i64 0, i64 0), i32 0, i32 32783)
%6 = tail call i32 @testmax(i16* getelementptr inbounds ([32 x i16], [32 x i16]* @main.C, i64 0, i64 0), i32 0, i32 65535)
ret i32 0
}