int big(int n) {
  char string[] = "a local string variable saved in the stack memory";
  volatile unsigned x = n;
  int i;
  for (i = 0; i < 4; i++) {
    x *= 3 + i;
    x ^= 0xf0f0f0f0;
    x &= (1 << i) - 1;
    if (x == 0)
      x = (unsigned)string[i] << i;
  }
  return n;
}


x86 assembly (clang, -O0):
<big>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeda(%rip),%rsi
mov    $0x32,%edx
call   1030 <memcpy@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x4,-0x48(%rbp)
jge    11a8 <big+0x98>
mov    -0x48(%rbp),%ecx
add    $0x3,%ecx
mov    -0x44(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
xor    $0xf0f0f0f0,%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
sub    $0x1,%ecx
mov    -0x44(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    $0x0,%eax
jne    1195 <big+0x85>
movslq -0x48(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
mov    -0x48(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x44(%rbp)
jmp    119a <big+0x8a>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    113d <big+0x2d>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big>:
mov    %edi,%eax
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %ecx,-0x4(%rsp)
xorl   $0xf0f0f0f0,-0x4(%rsp)
f0
mov    -0x4(%rsp),%ecx
movl   $0x0,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jne    1134 <big+0x34>
movl   $0x61,-0x4(%rsp)
shll   $0x2,-0x4(%rsp)
xorl   $0xf0f0f0f0,-0x4(%rsp)
f0
andl   $0x1,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jne    1155 <big+0x55>
movl   $0x40,-0x4(%rsp)
mov    -0x4(%rsp),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %ecx,-0x4(%rsp)
xorl   $0xf0f0f0f0,-0x4(%rsp)
f0
andl   $0x3,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jne    117c <big+0x7c>
movl   $0x1b0,-0x4(%rsp)
mov    -0x4(%rsp),%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %ecx,-0x4(%rsp)
xorl   $0xf0f0f0f0,-0x4(%rsp)
f0
andl   $0x7,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
je     119e <big+0x9e>
ret
movl   $0x378,-0x4(%rsp)
ret

LLVM IR (-O0):
@__const.big.string = [50 x i8] c"a local string variable saved in the stack memory\00"
define i32 @big(i32 %0) {
%2 = alloca i32
%3 = alloca [50 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = bitcast [50 x i8]* %3 to i8*
%7 = load i32, i32* %2
store volatile i32 %7, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %34, %1
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %37
11: ; preds = %8
%12 = load i32, i32* %5
%13 = add nsw i32 3, %12
%14 = load volatile i32, i32* %4
%15 = mul i32 %14, %13
store volatile i32 %15, i32* %4
%16 = load volatile i32, i32* %4
%17 = xor i32 %16, -252645136
store volatile i32 %17, i32* %4
%18 = load i32, i32* %5
%19 = shl i32 1, %18
%20 = sub nsw i32 %19, 1
%21 = load volatile i32, i32* %4
%22 = and i32 %21, %20
store volatile i32 %22, i32* %4
%23 = load volatile i32, i32* %4
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %11
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = load i32, i32* %5
%32 = shl i32 %30, %31
store volatile i32 %32, i32* %4
br label %33
33: ; preds = %25, %11
br label %34
34: ; preds = %33
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %8
37: ; preds = %8
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @big(i32 returned %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store volatile i32 %0, i32* %2
%4 = load volatile i32, i32* %2
%5 = mul i32 %4, 3
store volatile i32 %5, i32* %2
%6 = load volatile i32, i32* %2
%7 = xor i32 %6, -252645136
store volatile i32 %7, i32* %2
%8 = load volatile i32, i32* %2
store volatile i32 0, i32* %2
%9 = load volatile i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store volatile i32 97, i32* %2
br label %12
12: ; preds = %1, %11
%13 = load volatile i32, i32* %2
%14 = shl i32 %13, 2
store volatile i32 %14, i32* %2
%15 = load volatile i32, i32* %2
%16 = xor i32 %15, -252645136
store volatile i32 %16, i32* %2
%17 = load volatile i32, i32* %2
%18 = and i32 %17, 1
store volatile i32 %18, i32* %2
%19 = load volatile i32, i32* %2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %12
store volatile i32 64, i32* %2
br label %22
22: ; preds = %21, %12
%23 = load volatile i32, i32* %2
%24 = mul i32 %23, 5
store volatile i32 %24, i32* %2
%25 = load volatile i32, i32* %2
%26 = xor i32 %25, -252645136
store volatile i32 %26, i32* %2
%27 = load volatile i32, i32* %2
%28 = and i32 %27, 3
store volatile i32 %28, i32* %2
%29 = load volatile i32, i32* %2
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %22
store volatile i32 432, i32* %2
br label %32
32: ; preds = %31, %22
%33 = load volatile i32, i32* %2
%34 = mul i32 %33, 6
store volatile i32 %34, i32* %2
%35 = load volatile i32, i32* %2
%36 = xor i32 %35, -252645136
store volatile i32 %36, i32* %2
%37 = load volatile i32, i32* %2
%38 = and i32 %37, 7
store volatile i32 %38, i32* %2
%39 = load volatile i32, i32* %2
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %32
store volatile i32 888, i32* %2
br label %42
42: ; preds = %41, %32
ret i32 %0
}