#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*/ printf(char *, ...);
int result(short *to, short *from, int count) {
  int i;
  for (i = 0; i < count; ++i) {
    printf("(%d, %d)", to[i], from[i]);
    if (i < count - 1) {
      printf(", ");
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118e <result+0x7e>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movswl (%rax,%rcx,2),%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movswl (%rax,%rcx,2),%edx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117b <result+0x6b>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1180 <result+0x70>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <result+0x1a>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<result>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1183 <result+0x63>
mov    %rsi,%r14
mov    %rdi,%r13
lea    -0x1(%rdx),%ebx
mov    %edx,%ebp
lea    0xebf(%rip),%r15
xor    %r12d,%r12d
jmp    1159 <result+0x39>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    %r12,%rbp
je     1183 <result+0x63>
movswl 0x0(%r13,%r12,2),%esi
movswl (%r14,%r12,2),%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %rbx,%r12
jae    1150 <result+0x30>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <result+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"(%d, %d)\00"
@.str.1 = [3 x i8] c", \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @result(i16* %0, i16* %1, i32 %2) {
%4 = alloca i16*
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32
store i16* %0, i16** %4
store i16* %1, i16** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %33, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %36
12: ; preds = %8
%13 = load i16*, i16** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i16, i16* %13, i64 %15
%17 = load i16, i16* %16
%18 = sext i16 %17 to i32
%19 = load i16*, i16** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i16, i16* %19, i64 %21
%23 = load i16, i16* %22
%24 = sext i16 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %24)
%26 = load i32, i32* %7
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 1
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %32
30: ; preds = %12
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %12
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %8
36: ; preds = %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"(%d, %d)\00"
@.str.1 = [3 x i8] c", \00"
define i32 @result(i16* nocapture %0, i16* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %24
5: ; preds = %3
%6 = add nsw i32 %2, -1
%7 = zext i32 %6 to i64
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %5, %21
%10 = phi i64 [ 0, %5 ], [ %22, %21 ]
%11 = getelementptr inbounds i16, i16* %0, i64 %10
%12 = load i16, i16* %11
%13 = sext i16 %12 to i32
%14 = getelementptr inbounds i16, i16* %1, i64 %10
%15 = load i16, i16* %14
%16 = sext i16 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %16)
%18 = icmp ult i64 %10, %7
br i1 %18, label %19, label %21
19: ; preds = %9
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %9, %19
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, %8
br i1 %23, label %24, label %9
24: ; preds = %21, %3
%25 = tail call i32 @putchar(i32 10)
ret i32 0
}