#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*/ test_pack(int, int, int, int, int);
int main(int argc, char **argv) {
  int i;
  (void)argc;
  (void)argv;
  test_pack(1, 100, 100, 1024, 1024);
  for (i = 0; i < 50; i++)
    test_pack(100, 100, 100, 1024, 1024);
  for (i = 0; i < 10; i++)
    test_pack(10000, 32, 32, 4096, 4096);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
mov    $0x64,%edx
mov    $0x400,%r8d
mov    %edx,%esi
mov    %r8d,%ecx
call   1030 <test_pack@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jge    1176 <main+0x66>
mov    $0x64,%edx
mov    $0x400,%r8d
mov    %edx,%edi
mov    %edx,%esi
mov    %r8d,%ecx
call   1030 <test_pack@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <main+0x37>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11af <main+0x9f>
mov    $0x2710,%edi
mov    $0x20,%edx
mov    $0x1000,%r8d
mov    %edx,%esi
mov    %r8d,%ecx
call   1030 <test_pack@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <main+0x6d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x64,%esi
mov    $0x64,%edx
mov    $0x400,%ecx
mov    $0x400,%r8d
call   1030 <test_pack@plt>
mov    $0x32,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x64,%edi
mov    $0x64,%esi
mov    $0x64,%edx
mov    $0x400,%ecx
mov    $0x400,%r8d
call   1030 <test_pack@plt>
add    $0xffffffff,%ebx
jne    1140 <main+0x30>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
mov    $0x2710,%edi
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x1000,%ecx
mov    $0x1000,%r8d
call   1030 <test_pack@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @test_pack(i32 1, i32 100, i32 100, i32 1024, i32 1024)
store i32 0, i32* %6
br label %10
10: ; preds = %15, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 50
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = call i32 @test_pack(i32 100, i32 100, i32 100, i32 1024, i32 1024)
br label %15
15: ; preds = %13
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %10
18: ; preds = %10
store i32 0, i32* %6
br label %19
19: ; preds = %24, %18
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
br label %24
24: ; preds = %22
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %19
27: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @test_pack(i32 1, i32 100, i32 100, i32 1024, i32 1024)
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %7, %4 ]
%6 = tail call i32 @test_pack(i32 100, i32 100, i32 100, i32 1024, i32 1024)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 50
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%11 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%12 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%13 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%14 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%15 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%16 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%17 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%18 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
%19 = tail call i32 @test_pack(i32 10000, i32 32, i32 32, i32 4096, i32 4096)
ret i32 0
}