#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, int, int);
int pow(int, int);
void packet_2() {
  int lock_mode;
  int strategy;
  int work;
  for (int m = 0; m < 5; m++) {
    for (int w = 0; w < 4; w++) {
      for (int s = 0; s < 4; s++) {
        if (s != 1) {
          lock_mode = pow(2, m);
          strategy = pow(2, s);
          work = 1000 * pow(2, w);
          loop("PACKET_2", 524288 / 4, 1, work, 1, lock_mode, strategy);
          loop("PACKET_2", 524288 / 4, 2, work, 1, lock_mode, strategy);
          loop("PACKET_2", 524288 / 4, 3, work, 1, lock_mode, strategy);
          loop("PACKET_2", 524288 / 4, 7, work, 1, lock_mode, strategy);
          loop("PACKET_2", 524288 / 4, 15, work, 1, lock_mode, strategy);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<packet_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    129f <packet_2+0x17f>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    128c <packet_2+0x16c>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1279 <packet_2+0x159>
cmpl   $0x1,-0x18(%rbp)
je     1266 <packet_2+0x146>
mov    -0x10(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x8(%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    0xe54(%rip),%rdi
mov    $0x20000,%esi
mov    $0x1,%r8d
mov    %r8d,%edx
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe2d(%rip),%rdi
mov    $0x20000,%esi
mov    $0x2,%edx
mov    $0x1,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe04(%rip),%rdi
mov    $0x20000,%esi
mov    $0x3,%edx
mov    $0x1,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xddb(%rip),%rdi
mov    $0x20000,%esi
mov    $0x7,%edx
mov    $0x1,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xdb2(%rip),%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
mov    $0x1,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
jmp    126b <packet_2+0x14b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <packet_2+0x31>
jmp    127e <packet_2+0x15e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <packet_2+0x20>
jmp    1291 <packet_2+0x171>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112f <packet_2+0xf>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"PACKET_2\00"
define void @packet_2() {
br label %1
1: ; preds = %0, %35
%2 = phi i32 [ 0, %0 ], [ %36, %35 ]
br label %4
3: ; preds = %35
ret void
4: ; preds = %4, %1
%5 = phi i32 [ 0, %1 ], [ %33, %4 ]
%6 = tail call i32 @pow(i32 2, i32 %2)
%7 = tail call i32 @pow(i32 2, i32 0)
%8 = tail call i32 @pow(i32 2, i32 %5)
%9 = mul nsw i32 %8, 1000
%10 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 1, i32 %9, i32 1, i32 %6, i32 %7)
%11 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 2, i32 %9, i32 1, i32 %6, i32 %7)
%12 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 3, i32 %9, i32 1, i32 %6, i32 %7)
%13 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 7, i32 %9, i32 1, i32 %6, i32 %7)
%14 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 15, i32 %9, i32 1, i32 %6, i32 %7)
%15 = tail call i32 @pow(i32 2, i32 %2)
%16 = tail call i32 @pow(i32 2, i32 2)
%17 = tail call i32 @pow(i32 2, i32 %5)
%18 = mul nsw i32 %17, 1000
%19 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 1, i32 %18, i32 1, i32 %15, i32 %16)
%20 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 2, i32 %18, i32 1, i32 %15, i32 %16)
%21 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 3, i32 %18, i32 1, i32 %15, i32 %16)
%22 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 7, i32 %18, i32 1, i32 %15, i32 %16)
%23 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 15, i32 %18, i32 1, i32 %15, i32 %16)
%24 = tail call i32 @pow(i32 2, i32 %2)
%25 = tail call i32 @pow(i32 2, i32 3)
%26 = tail call i32 @pow(i32 2, i32 %5)
%27 = mul nsw i32 %26, 1000
%28 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 1, i32 %27, i32 1, i32 %24, i32 %25)
%29 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 2, i32 %27, i32 1, i32 %24, i32 %25)
%30 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 3, i32 %27, i32 1, i32 %24, i32 %25)
%31 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 7, i32 %27, i32 1, i32 %24, i32 %25)
%32 = tail call i32 @loop(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 131072, i32 15, i32 %27, i32 1, i32 %24, i32 %25)
%33 = add nuw nsw i32 %5, 1
%34 = icmp eq i32 %33, 4
br i1 %34, label %35, label %4
35: ; preds = %4
%36 = add nuw nsw i32 %2, 1
%37 = icmp eq i32 %36, 5
br i1 %37, label %3, label %1
}