#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*/ abort();
int /*<<< orphan*/ bar(unsigned char *, unsigned char *, int, int *);
int main(void) {
  unsigned char m[256];
  unsigned char n[256];
  int sum, i;
  for (i = 0; i < 256; ++i)
    if (i % 2 == 0) {
      m[i] = (i % 8) * 2 + 1;
      n[i] = -(i % 8);
    } else {
      m[i] = -((i % 8) * 2 + 2);
      n[i] = -((i % 8) >> 1);
    }
  bar(m, n, 16, &sum);
  if (sum != 32384)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x218(%rbp)
cmpl   $0x100,-0x218(%rbp)
jge    1218 <main+0xf8>
mov    -0x218(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b0 <main+0x90>
mov    -0x218(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %al,%cl
movslq -0x218(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x218(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
sub    %edx,%eax
mov    %al,%cl
movslq -0x218(%rbp),%rax
mov    %cl,-0x210(%rbp,%rax,1)
jmp    11ff <main+0xdf>
mov    -0x218(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %al,%cl
movslq -0x218(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x218(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
sar    $0x1,%edx
xor    %eax,%eax
sub    %edx,%eax
mov    %al,%cl
movslq -0x218(%rbp),%rax
mov    %cl,-0x210(%rbp,%rax,1)
jmp    1204 <main+0xe4>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    113c <main+0x1c>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x10,%edx
lea    -0x214(%rbp),%rcx
call   1040 <bar@plt>
cmpl   $0x7e80,-0x214(%rbp)
je     124e <main+0x12e>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x218,%rsp
movdqa 0xed1(%rip),%xmm0
movdqa 0xed8(%rip),%xmm12
movdqa 0xedf(%rip),%xmm8
movdqa 0xee6(%rip),%xmm10
movdqa 0xeee(%rip),%xmm4
xor    %eax,%eax
movdqa 0xef3(%rip),%xmm11
pxor   %xmm13,%xmm13
movdqa 0xef5(%rip),%xmm14
movdqa 0xf2c(%rip),%xmm15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm0,%xmm6
pand   %xmm11,%xmm6
movdqa %xmm12,%xmm1
pand   %xmm11,%xmm1
movdqa %xmm8,%xmm2
pand   %xmm11,%xmm2
movdqa %xmm10,%xmm3
pand   %xmm11,%xmm3
pcmpeqd %xmm13,%xmm3
pcmpeqd %xmm13,%xmm2
packssdw %xmm2,%xmm3
pcmpeqd %xmm13,%xmm1
pcmpeqd %xmm13,%xmm6
packssdw %xmm6,%xmm1
packsswb %xmm1,%xmm3
movdqa %xmm12,%xmm5
pand   %xmm14,%xmm5
movdqa %xmm0,%xmm2
pand   %xmm14,%xmm2
movdqa %xmm10,%xmm7
pand   %xmm14,%xmm7
movdqa %xmm8,%xmm9
pand   %xmm14,%xmm9
movdqa %xmm7,%xmm6
packuswb %xmm9,%xmm6
movdqa %xmm5,%xmm1
packuswb %xmm2,%xmm1
packuswb %xmm1,%xmm6
paddb  %xmm6,%xmm6
movdqa 0xe61(%rip),%xmm1
psubb  %xmm6,%xmm1
psrld  $0x1,%xmm5
psrld  $0x1,%xmm2
packuswb %xmm2,%xmm5
psrld  $0x1,%xmm7
psrld  $0x1,%xmm9
packuswb %xmm9,%xmm7
packuswb %xmm5,%xmm7
movdqa %xmm4,%xmm2
pand   0xe3f(%rip),%xmm2
movdqa %xmm3,%xmm5
pandn  %xmm1,%xmm5
movdqa %xmm2,%xmm1
paddb  %xmm2,%xmm1
por    0xe37(%rip),%xmm1
pand   %xmm3,%xmm1
por    %xmm5,%xmm1
pand   %xmm3,%xmm2
pandn  %xmm7,%xmm3
por    %xmm2,%xmm3
pxor   %xmm2,%xmm2
psubb  %xmm3,%xmm2
movdqa %xmm1,0x110(%rsp,%rax,1)
movdqa %xmm2,0x10(%rsp,%rax,1)
add    $0x10,%rax
paddd  %xmm15,%xmm10
paddd  %xmm15,%xmm8
paddd  %xmm15,%xmm12
paddd  %xmm15,%xmm0
paddb  0xe0c(%rip),%xmm4
cmp    $0x100,%rax
jne    1180 <main+0x60>
lea    0x110(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    $0x10,%edx
call   1040 <bar@plt>
cmpl   $0x7e80,0xc(%rsp)
jne    12e0 <main+0x1c0>
xor    %eax,%eax
add    $0x218,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %48, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 256
br i1 %8, label %9, label %51
9: ; preds = %6
%10 = load i32, i32* %5
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = load i32, i32* %5
%15 = srem i32 %14, 8
%16 = mul nsw i32 %15, 2
%17 = add nsw i32 %16, 1
%18 = trunc i32 %17 to i8
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %20
store i8 %18, i8* %21
%22 = load i32, i32* %5
%23 = srem i32 %22, 8
%24 = sub nsw i32 0, %23
%25 = trunc i32 %24 to i8
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %27
store i8 %25, i8* %28
br label %47
29: ; preds = %9
%30 = load i32, i32* %5
%31 = srem i32 %30, 8
%32 = mul nsw i32 %31, 2
%33 = add nsw i32 %32, 2
%34 = sub nsw i32 0, %33
%35 = trunc i32 %34 to i8
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %37
store i8 %35, i8* %38
%39 = load i32, i32* %5
%40 = srem i32 %39, 8
%41 = ashr i32 %40, 1
%42 = sub nsw i32 0, %41
%43 = trunc i32 %42 to i8
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %45
store i8 %43, i8* %46
br label %47
47: ; preds = %29, %13
br label %48
48: ; preds = %47
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %6
51: ; preds = %6
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%54 = call i32 @bar(i8* %52, i8* %53, i32 16, i32* %4)
%55 = load i32, i32* %4
%56 = icmp ne i32 %55, 32384
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = call i32 (...) @abort()
unreachable
59: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ 0, %0 ], [ %29, %7 ]
%9 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %0 ], [ %30, %7 ]
%10 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %0 ], [ %31, %7 ]
%11 = and <16 x i32> %9, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%12 = icmp eq <16 x i32> %11, zeroinitializer
%13 = and <16 x i32> %9, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
%14 = trunc <16 x i32> %13 to <16 x i8>
%15 = mul nsw <16 x i8> %14, <i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2>
%16 = add nsw <16 x i8> %15, <i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2, i8 -2>
%17 = lshr <16 x i32> %13, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%18 = trunc <16 x i32> %17 to <16 x i8>
%19 = and <16 x i8> %10, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
%20 = shl nuw nsw <16 x i8> %19, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%21 = or <16 x i8> %20, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
%22 = select <16 x i1> %12, <16 x i8> %21, <16 x i8> %16
%23 = select <16 x i1> %12, <16 x i8> %19, <16 x i8> %18
%24 = sub nsw <16 x i8> zeroinitializer, %23
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %8
%26 = bitcast i8* %25 to <16 x i8>*
store <16 x i8> %22, <16 x i8>* %26
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %8
%28 = bitcast i8* %27 to <16 x i8>*
store <16 x i8> %24, <16 x i8>* %28
%29 = add nuw i64 %8, 16
%30 = add <16 x i32> %9, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
%31 = add <16 x i8> %10, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%32 = icmp eq i64 %29, 256
br i1 %32, label %33, label %7
33: ; preds = %7
%34 = call i32 @bar(i8* %4, i8* %5, i32 16, i32* %3)
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 32384
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = call i32 (...) @abort()
unreachable
39: ; preds = %33
ret i32 0
}