#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 int /*<<< orphan*/ array2;
typedef int /*<<< orphan*/ array1;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void zip(int *array1, int *array2) {
  int i;
  int len1 = sizeof(array1);
  int len2 = sizeof(array2);
  int min = len1 < len2 ? len1 : len2;
  printf("Len1: %d  Len2: %d  min: %d \n", len1, len2, min);
  int resarray[min][2];
  int pair[2];
  for (i = 0; i < min; i++) {
    pair[0] = array1[i];
    pair[1] = array2[i];
    resarray[i][0] = pair[0];
    resarray[i][1] = pair[1];
    printf("Result[%d] is (%d,%d) \n", i, resarray[i][0], resarray[i][1]);
  }
}


x86 assembly (clang, -O0):
<zip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x18(%rbp)
movl   $0x8,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1145 <zip+0x35>
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    114b <zip+0x3b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1201 <zip+0xf1>
mov    -0x48(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    %ecx,-0x38(%rbp)
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    %ecx,-0x34(%rbp)
mov    -0x38(%rbp),%edx
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,8)
mov    -0x34(%rbp),%edx
movslq -0x14(%rbp),%rcx
mov    %edx,0x4(%rax,%rcx,8)
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%edx
movslq -0x14(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%ecx
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <zip+0x84>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zip>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xede(%rip),%rdi
mov    $0x8,%esi
mov    $0x8,%edx
mov    $0x8,%ecx
call   1030 <printf@plt>
mov    (%rbx),%edx
mov    (%r14),%ecx
lea    0xedc(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x4(%rbx),%edx
mov    0x4(%r14),%ecx
mov    %r15,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rbx),%edx
mov    0x8(%r14),%ecx
mov    %r15,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rbx),%edx
mov    0xc(%r14),%ecx
mov    %r15,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rbx),%edx
mov    0x10(%r14),%ecx
mov    %r15,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rbx),%edx
mov    0x14(%r14),%ecx
mov    %r15,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rbx),%edx
mov    0x18(%r14),%ecx
mov    %r15,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x1c(%rbx),%edx
mov    0x1c(%r14),%ecx
mov    %r15,%rdi
mov    $0x7,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Len1: %d Len2: %d min: %d \0A\00"
@.str.1 = [24 x i8] c"Result[%d] is (%d,%d) \0A\00"
define void @zip(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca [2 x i32]
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 8, i32* %6
store i32 8, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = load i32, i32* %6
br label %19
17: ; preds = %2
%18 = load i32, i32* %7
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %18, %17 ]
store i32 %20, i32* %8
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* %8
%26 = zext i32 %25 to i64
%27 = call i8* @llvm.stacksave()
store i8* %27, i8** %9
%28 = alloca [2 x i32], i64 %26
store i64 %26, i64* %10
store i32 0, i32* %5
br label %29
29: ; preds = %70, %19
%30 = load i32, i32* %5
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %73
33: ; preds = %29
%34 = load i32*, i32** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
store i32 %38, i32* %39
%40 = load i32*, i32** %4
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
store i32 %44, i32* %45
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%47 = load i32, i32* %46
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 %49
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %50, i64 0, i64 0
store i32 %47, i32* %51
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
%53 = load i32, i32* %52
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 %55
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %56, i64 0, i64 1
store i32 %53, i32* %57
%58 = load i32, i32* %5
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 %60
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %61, i64 0, i64 0
%63 = load i32, i32* %62
%64 = load i32, i32* %5
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 %65
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %66, i64 0, i64 1
%68 = load i32, i32* %67
%69 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %58, i32 %63, i32 %68)
br label %70
70: ; preds = %33
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %29
73: ; preds = %29
%74 = load i8*, i8** %9
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Len1: %d Len2: %d min: %d \0A\00"
@.str.1 = [24 x i8] c"Result[%d] is (%d,%d) \0A\00"
define void @zip(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 8, i32 8, i32 8)
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %4, i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %1, i64 1
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %8, i32 %10)
%12 = getelementptr inbounds i32, i32* %0, i64 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %1, i64 2
%15 = load i32, i32* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %13, i32 %15)
%17 = getelementptr inbounds i32, i32* %0, i64 3
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %1, i64 3
%20 = load i32, i32* %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %18, i32 %20)
%22 = getelementptr inbounds i32, i32* %0, i64 4
%23 = load i32, i32* %22
%24 = getelementptr inbounds i32, i32* %1, i64 4
%25 = load i32, i32* %24
%26 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %23, i32 %25)
%27 = getelementptr inbounds i32, i32* %0, i64 5
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %1, i64 5
%30 = load i32, i32* %29
%31 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %28, i32 %30)
%32 = getelementptr inbounds i32, i32* %0, i64 6
%33 = load i32, i32* %32
%34 = getelementptr inbounds i32, i32* %1, i64 6
%35 = load i32, i32* %34
%36 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %33, i32 %35)
%37 = getelementptr inbounds i32, i32* %0, i64 7
%38 = load i32, i32* %37
%39 = getelementptr inbounds i32, i32* %1, i64 7
%40 = load i32, i32* %39
%41 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %38, i32 %40)
ret void
}