#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*/ loop(char *, int, int, int, int /*<<< orphan*/, int, int);
int pow(int, int);
void packet_4() {
  int lock_mode;
  int strategy = 16;
  int work;
  for (int m = 0; m < 5; m++) {
    for (int w = 0; w < 4; w++) {
      lock_mode = pow(2, m);
      work = 1000 * pow(2, w);
      loop("PACKET_4", 524288 / 4, 1, work, 0, lock_mode, strategy);
      loop("PACKET_4", 524288 / 4, 2, work, 0, lock_mode, strategy);
      loop("PACKET_4", 524288 / 4, 3, work, 0, lock_mode, strategy);
      loop("PACKET_4", 524288 / 4, 7, work, 0, lock_mode, strategy);
      loop("PACKET_4", 524288 / 4, 15, work, 0, lock_mode, strategy);
    }
  }
}


x86 assembly (clang, -O0):
<packet_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x10,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1256 <packet_4+0x136>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1243 <packet_4+0x123>
mov    -0x10(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe78(%rip),%rdi
mov    $0x20000,%esi
mov    $0x1,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe52(%rip),%rdi
mov    $0x20000,%esi
mov    $0x2,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe2c(%rip),%rdi
mov    $0x20000,%esi
mov    $0x3,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe06(%rip),%rdi
mov    $0x20000,%esi
mov    $0x7,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xde0(%rip),%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <packet_4+0x27>
jmp    1248 <packet_4+0x128>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <packet_4+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packet_4>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %r14d,%r14d
lea    0xeca(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2,%edi
mov    %r14d,%esi
call   1040 <pow@plt>
mov    %eax,%r12d
mov    $0x2,%edi
mov    %ebp,%esi
call   1040 <pow@plt>
imul   $0x3e8,%eax,%ebx
movl   $0x10,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x1,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r12d,%r9d
call   1030 <loop@plt>
movl   $0x10,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x2,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r12d,%r9d
call   1030 <loop@plt>
movl   $0x10,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x3,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r12d,%r9d
call   1030 <loop@plt>
movl   $0x10,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x7,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r12d,%r9d
call   1030 <loop@plt>
movl   $0x10,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r12d,%r9d
call   1030 <loop@plt>
add    $0x1,%ebp
cmp    $0x4,%ebp
jne    1150 <packet_4+0x30>
add    $0x1,%r14d
cmp    $0x5,%r14d
jne    1140 <packet_4+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"PACKET_4\00"
define void @packet_4() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 16, i32* %2
store i32 0, i32* %4
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %46
9: ; preds = %6
store i32 0, i32* %5
br label %10
10: ; preds = %39, %9
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %42
13: ; preds = %10
%14 = load i32, i32* %4
%15 = call i32 @pow(i32 2, i32 %14)
store i32 %15, i32* %1
%16 = load i32, i32* %5
%17 = call i32 @pow(i32 2, i32 %16)
%18 = mul nsw i32 1000, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 1, i32 %19, i32 0, i32 %20, i32 %21)
%23 = load i32, i32* %3
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 2, i32 %23, i32 0, i32 %24, i32 %25)
%27 = load i32, i32* %3
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 3, i32 %27, i32 0, i32 %28, i32 %29)
%31 = load i32, i32* %3
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 7, i32 %31, i32 0, i32 %32, i32 %33)
%35 = load i32, i32* %3
%36 = load i32, i32* %1
%37 = load i32, i32* %2
%38 = call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 15, i32 %35, i32 0, i32 %36, i32 %37)
br label %39
39: ; preds = %13
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %10
42: ; preds = %10
br label %43
43: ; preds = %42
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %6
46: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"PACKET_4\00"
define void @packet_4() {
br label %1
1: ; preds = %0, %4
%2 = phi i32 [ 0, %0 ], [ %5, %4 ]
br label %7
3: ; preds = %4
ret void
4: ; preds = %7
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 5
br i1 %6, label %3, label %1
7: ; preds = %1, %7
%8 = phi i32 [ 0, %1 ], [ %17, %7 ]
%9 = tail call i32 @pow(i32 2, i32 %2)
%10 = tail call i32 @pow(i32 2, i32 %8)
%11 = mul nsw i32 %10, 1000
%12 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 1, i32 %11, i32 0, i32 %9, i32 16)
%13 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 2, i32 %11, i32 0, i32 %9, i32 16)
%14 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 3, i32 %11, i32 0, i32 %9, i32 16)
%15 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 7, i32 %11, i32 0, i32 %9, i32 16)
%16 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 15, i32 %11, i32 0, i32 %9, i32 16)
%17 = add nuw nsw i32 %8, 1
%18 = icmp eq i32 %17, 4
br i1 %18, label %4, label %7
}