#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_3() {
  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_3", 524288 / 4, 1, work, 0, lock_mode, strategy);
          loop("PACKET_3", 524288 / 4, 2, work, 0, lock_mode, strategy);
          loop("PACKET_3", 524288 / 4, 3, work, 0, lock_mode, strategy);
          loop("PACKET_3", 524288 / 4, 7, work, 0, lock_mode, strategy);
          loop("PACKET_3", 524288 / 4, 15, work, 0, lock_mode, strategy);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<packet_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1292 <packet_3+0x172>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    127f <packet_3+0x15f>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    126c <packet_3+0x14c>
cmpl   $0x1,-0x18(%rbp)
je     1259 <packet_3+0x139>
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,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xe2e(%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    0xe08(%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    0xde2(%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    0xdbc(%rip),%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1030 <loop@plt>
jmp    125e <packet_3+0x13e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <packet_3+0x31>
jmp    1271 <packet_3+0x151>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <packet_3+0x20>
jmp    1284 <packet_3+0x164>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112f <packet_3+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packet_3>:
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
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x2,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x3,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x7,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
mov    %ebx,%ecx
xor    %r8d,%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
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x2,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x3,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x7,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
mov    %ebx,%ecx
xor    %r8d,%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
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x2,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x3,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0x7,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
mov    %ebp,(%rsp)
mov    %r15,%rdi
mov    $0x20000,%esi
mov    $0xf,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1030 <loop@plt>
add    $0x1,%r12d
cmp    $0x4,%r12d
jne    1150 <packet_3+0x30>
add    $0x1,%r14d
cmp    $0x5,%r14d
jne    1140 <packet_3+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_3\00"
define void @packet_3() {
%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 0, 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 0, 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 0, 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 0, 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 0, 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_3\00"
define void @packet_3() {
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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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 0, 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
}