#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int *ptr_int1;
  int *ptr_int2;
  int ndx;
  ptr_int1 = (int *)malloc(50 * sizeof(int));
  ptr_int2 = (int *)calloc(50, sizeof(int));
  for (ndx = 0; ndx < 5; ndx++) {
    ptr_int1[ndx] = 2007 + ndx;
    ptr_int2[ndx] = 2007 + ndx;
  }
  for (ndx = 0; ndx < 5; ndx++) {
    printf("%d %d\n", ptr_int1[ndx], ptr_int2[ndx]);
  }
  free(ptr_int1);
  free(ptr_int2);
  for (ndx = 0; ndx < 5; ndx++) {
    printf("%d %d\n", ptr_int1[ndx], ptr_int2[ndx]);
  }
  ptr_int1 = NULL;
  ptr_int2 = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x32,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11b7 <main+0x77>
mov    -0x1c(%rbp),%edx
add    $0x7d7,%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%edx
add    $0x7d7,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1177 <main+0x37>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11f8 <main+0xb8>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe1b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11be <main+0x7e>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    124b <main+0x10b>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xdc8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1211 <main+0xd1>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xc8,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x32,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
movl   $0x7d7,(%r14)
movl   $0x7d7,(%rax)
movl   $0x7d8,0x4(%r14)
movl   $0x7d8,0x4(%rax)
movl   $0x7d9,0x8(%r14)
movl   $0x7d9,0x8(%rax)
movl   $0x7da,0xc(%r14)
movl   $0x7da,0xc(%rax)
movl   $0x7db,0x10(%r14)
movl   $0x7db,0x10(%rax)
mov    (%r14),%esi
mov    (%rax),%edx
lea    0xe47(%rip),%r15
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x4(%r14),%esi
mov    0x4(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x8(%r14),%esi
mov    0x8(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0xc(%r14),%esi
mov    0xc(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x10(%r14),%esi
mov    0x10(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%r14),%esi
mov    (%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x4(%r14),%esi
mov    0x4(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x8(%r14),%esi
mov    0x8(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0xc(%r14),%esi
mov    0xc(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x10(%r14),%esi
mov    0x10(%rbx),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 200)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i64 @calloc(i32 50, i32 4)
%4 = inttoptr i64 %3 to i32*
store i32 2007, i32* %2
store i32 2007, i32* %4
%5 = getelementptr inbounds i32, i32* %2, i64 1
store i32 2008, i32* %5
%6 = getelementptr inbounds i32, i32* %4, i64 1
store i32 2008, i32* %6
%7 = getelementptr inbounds i32, i32* %2, i64 2
store i32 2009, i32* %7
%8 = getelementptr inbounds i32, i32* %4, i64 2
store i32 2009, i32* %8
%9 = getelementptr inbounds i32, i32* %2, i64 3
store i32 2010, i32* %9
%10 = getelementptr inbounds i32, i32* %4, i64 3
store i32 2010, i32* %10
%11 = getelementptr inbounds i32, i32* %2, i64 4
store i32 2011, i32* %11
%12 = getelementptr inbounds i32, i32* %4, i64 4
store i32 2011, i32* %12
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
%22 = load i32, i32* %9
%23 = load i32, i32* %10
%24 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23)
%25 = load i32, i32* %11
%26 = load i32, i32* %12
%27 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26)
%28 = tail call i32 @free(i32* %2)
%29 = tail call i32 @free(i32* %4)
%30 = load i32, i32* %2
%31 = load i32, i32* %4
%32 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %31)
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34)
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %37)
%39 = load i32, i32* %9
%40 = load i32, i32* %10
%41 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %39, i32 %40)
%42 = load i32, i32* %11
%43 = load i32, i32* %12
%44 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %42, i32 %43)
ret i32 0
}