#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*/ spoil(char volatile);
void testCastPack(char x) {
  int i, j;
  volatile char a = x;
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++) {
      spoil(a);
    }
  }
}


x86 assembly (clang, -O0):
<testCastPack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0xd(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1172 <testCastPack+0x62>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    115f <testCastPack+0x4f>
mov    -0xd(%rbp),%al
movsbl %al,%edi
call   1030 <spoil@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <testCastPack+0x2c>
jmp    1164 <testCastPack+0x54>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112b <testCastPack+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testCastPack>:
push   %rax
mov    %dil,0x7(%rsp)
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
call   1030 <spoil@plt>
movsbl 0x7(%rsp),%edi
pop    %rax
jmp    1030 <spoil@plt>

LLVM IR (-O0):
define void @testCastPack(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i8 %0, i8* %2
%6 = load i8, i8* %2
store volatile i8 %6, i8* %5
store i32 0, i32* %3
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %24
10: ; preds = %7
store i32 0, i32* %4
br label %11
11: ; preds = %17, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load volatile i8, i8* %5
%16 = call i32 @spoil(i8 signext %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %11
20: ; preds = %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %7
24: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @testCastPack(i8 signext %0) {
%2 = alloca i8
store volatile i8 %0, i8* %2
%3 = load volatile i8, i8* %2
%4 = tail call i32 @spoil(i8 signext %3)
%5 = load volatile i8, i8* %2
%6 = tail call i32 @spoil(i8 signext %5)
%7 = load volatile i8, i8* %2
%8 = tail call i32 @spoil(i8 signext %7)
%9 = load volatile i8, i8* %2
%10 = tail call i32 @spoil(i8 signext %9)
%11 = load volatile i8, i8* %2
%12 = tail call i32 @spoil(i8 signext %11)
%13 = load volatile i8, i8* %2
%14 = tail call i32 @spoil(i8 signext %13)
%15 = load volatile i8, i8* %2
%16 = tail call i32 @spoil(i8 signext %15)
%17 = load volatile i8, i8* %2
%18 = tail call i32 @spoil(i8 signext %17)
%19 = load volatile i8, i8* %2
%20 = tail call i32 @spoil(i8 signext %19)
%21 = load volatile i8, i8* %2
%22 = tail call i32 @spoil(i8 signext %21)
%23 = load volatile i8, i8* %2
%24 = tail call i32 @spoil(i8 signext %23)
%25 = load volatile i8, i8* %2
%26 = tail call i32 @spoil(i8 signext %25)
%27 = load volatile i8, i8* %2
%28 = tail call i32 @spoil(i8 signext %27)
%29 = load volatile i8, i8* %2
%30 = tail call i32 @spoil(i8 signext %29)
%31 = load volatile i8, i8* %2
%32 = tail call i32 @spoil(i8 signext %31)
%33 = load volatile i8, i8* %2
%34 = tail call i32 @spoil(i8 signext %33)
%35 = load volatile i8, i8* %2
%36 = tail call i32 @spoil(i8 signext %35)
%37 = load volatile i8, i8* %2
%38 = tail call i32 @spoil(i8 signext %37)
%39 = load volatile i8, i8* %2
%40 = tail call i32 @spoil(i8 signext %39)
%41 = load volatile i8, i8* %2
%42 = tail call i32 @spoil(i8 signext %41)
%43 = load volatile i8, i8* %2
%44 = tail call i32 @spoil(i8 signext %43)
%45 = load volatile i8, i8* %2
%46 = tail call i32 @spoil(i8 signext %45)
%47 = load volatile i8, i8* %2
%48 = tail call i32 @spoil(i8 signext %47)
%49 = load volatile i8, i8* %2
%50 = tail call i32 @spoil(i8 signext %49)
%51 = load volatile i8, i8* %2
%52 = tail call i32 @spoil(i8 signext %51)
ret void
}