#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 */
unsigned char bd(unsigned char, unsigned char);
void modprod(unsigned char a[], unsigned char b[], unsigned char res[]) {
  res[0] = bd(a[0], b[3]) ^ bd(a[1], b[2]) ^ bd(a[2], b[1]) ^ bd(a[3], b[0]);
  res[1] = bd(a[1], b[3]) ^ bd(a[2], b[2]) ^ bd(a[3], b[1]) ^ bd(a[0], b[0]);
  res[2] = bd(a[2], b[3]) ^ bd(a[3], b[2]) ^ bd(a[0], b[1]) ^ bd(a[1], b[0]);
  res[3] = bd(a[3], b[3]) ^ bd(a[0], b[2]) ^ bd(a[1], b[1]) ^ bd(a[2], b[0]);
}


x86 assembly (clang, -O0):
<modprod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x3(%rax),%esi
call   1030 <bd@plt>
movzbl %al,%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x2(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x48(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x1(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x44(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x40(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x3(%rax),%esi
call   1030 <bd@plt>
movzbl %al,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x2(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x3c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x1(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x38(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x34(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x3(%rax),%esi
call   1030 <bd@plt>
movzbl %al,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x2(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x30(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x1(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x2c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x28(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x3(%rax),%esi
call   1030 <bd@plt>
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x2(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x24(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl 0x1(%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x20(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <bd@plt>
mov    %al,%cl
mov    -0x1c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modprod>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movzbl (%rdi),%edi
movzbl 0x3(%rsi),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl 0x1(%rbx),%edi
movzbl 0x2(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%r12d
xor    %bpl,%r12b
movzbl 0x2(%rbx),%edi
movzbl 0x1(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl 0x3(%rbx),%edi
movzbl (%r15),%esi
call   1030 <bd@plt>
xor    %bpl,%al
xor    %r12b,%al
mov    %al,(%r14)
movzbl 0x1(%rbx),%edi
movzbl 0x3(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl 0x2(%rbx),%edi
movzbl 0x2(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%r12d
xor    %bpl,%r12b
movzbl 0x3(%rbx),%edi
movzbl 0x1(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl (%rbx),%edi
movzbl (%r15),%esi
call   1030 <bd@plt>
xor    %bpl,%al
xor    %r12b,%al
mov    %al,0x1(%r14)
movzbl 0x2(%rbx),%edi
movzbl 0x3(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl 0x3(%rbx),%edi
movzbl 0x2(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%r12d
xor    %bpl,%r12b
movzbl (%rbx),%edi
movzbl 0x1(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl 0x1(%rbx),%edi
movzbl (%r15),%esi
call   1030 <bd@plt>
xor    %bpl,%al
xor    %r12b,%al
mov    %al,0x2(%r14)
movzbl 0x3(%rbx),%edi
movzbl 0x3(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl (%rbx),%edi
movzbl 0x2(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%r12d
xor    %bpl,%r12b
movzbl 0x1(%rbx),%edi
movzbl 0x1(%r15),%esi
call   1030 <bd@plt>
mov    %eax,%ebp
movzbl 0x2(%rbx),%edi
movzbl (%r15),%esi
call   1030 <bd@plt>
xor    %bpl,%al
xor    %r12b,%al
mov    %al,0x3(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @modprod(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i64 3
%12 = load i8, i8* %11
%13 = call zeroext i8 @bd(i8 zeroext %9, i8 zeroext %12)
%14 = zext i8 %13 to i32
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = call zeroext i8 @bd(i8 zeroext %17, i8 zeroext %20)
%22 = zext i8 %21 to i32
%23 = xor i32 %14, %22
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = call zeroext i8 @bd(i8 zeroext %26, i8 zeroext %29)
%31 = zext i8 %30 to i32
%32 = xor i32 %23, %31
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 3
%35 = load i8, i8* %34
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i64 0
%38 = load i8, i8* %37
%39 = call zeroext i8 @bd(i8 zeroext %35, i8 zeroext %38)
%40 = zext i8 %39 to i32
%41 = xor i32 %32, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %6
%44 = getelementptr inbounds i8, i8* %43, i64 0
store i8 %42, i8* %44
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = load i8, i8* %46
%48 = load i8*, i8** %5
%49 = getelementptr inbounds i8, i8* %48, i64 3
%50 = load i8, i8* %49
%51 = call zeroext i8 @bd(i8 zeroext %47, i8 zeroext %50)
%52 = zext i8 %51 to i32
%53 = load i8*, i8** %4
%54 = getelementptr inbounds i8, i8* %53, i64 2
%55 = load i8, i8* %54
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i64 2
%58 = load i8, i8* %57
%59 = call zeroext i8 @bd(i8 zeroext %55, i8 zeroext %58)
%60 = zext i8 %59 to i32
%61 = xor i32 %52, %60
%62 = load i8*, i8** %4
%63 = getelementptr inbounds i8, i8* %62, i64 3
%64 = load i8, i8* %63
%65 = load i8*, i8** %5
%66 = getelementptr inbounds i8, i8* %65, i64 1
%67 = load i8, i8* %66
%68 = call zeroext i8 @bd(i8 zeroext %64, i8 zeroext %67)
%69 = zext i8 %68 to i32
%70 = xor i32 %61, %69
%71 = load i8*, i8** %4
%72 = getelementptr inbounds i8, i8* %71, i64 0
%73 = load i8, i8* %72
%74 = load i8*, i8** %5
%75 = getelementptr inbounds i8, i8* %74, i64 0
%76 = load i8, i8* %75
%77 = call zeroext i8 @bd(i8 zeroext %73, i8 zeroext %76)
%78 = zext i8 %77 to i32
%79 = xor i32 %70, %78
%80 = trunc i32 %79 to i8
%81 = load i8*, i8** %6
%82 = getelementptr inbounds i8, i8* %81, i64 1
store i8 %80, i8* %82
%83 = load i8*, i8** %4
%84 = getelementptr inbounds i8, i8* %83, i64 2
%85 = load i8, i8* %84
%86 = load i8*, i8** %5
%87 = getelementptr inbounds i8, i8* %86, i64 3
%88 = load i8, i8* %87
%89 = call zeroext i8 @bd(i8 zeroext %85, i8 zeroext %88)
%90 = zext i8 %89 to i32
%91 = load i8*, i8** %4
%92 = getelementptr inbounds i8, i8* %91, i64 3
%93 = load i8, i8* %92
%94 = load i8*, i8** %5
%95 = getelementptr inbounds i8, i8* %94, i64 2
%96 = load i8, i8* %95
%97 = call zeroext i8 @bd(i8 zeroext %93, i8 zeroext %96)
%98 = zext i8 %97 to i32
%99 = xor i32 %90, %98
%100 = load i8*, i8** %4
%101 = getelementptr inbounds i8, i8* %100, i64 0
%102 = load i8, i8* %101
%103 = load i8*, i8** %5
%104 = getelementptr inbounds i8, i8* %103, i64 1
%105 = load i8, i8* %104
%106 = call zeroext i8 @bd(i8 zeroext %102, i8 zeroext %105)
%107 = zext i8 %106 to i32
%108 = xor i32 %99, %107
%109 = load i8*, i8** %4
%110 = getelementptr inbounds i8, i8* %109, i64 1
%111 = load i8, i8* %110
%112 = load i8*, i8** %5
%113 = getelementptr inbounds i8, i8* %112, i64 0
%114 = load i8, i8* %113
%115 = call zeroext i8 @bd(i8 zeroext %111, i8 zeroext %114)
%116 = zext i8 %115 to i32
%117 = xor i32 %108, %116
%118 = trunc i32 %117 to i8
%119 = load i8*, i8** %6
%120 = getelementptr inbounds i8, i8* %119, i64 2
store i8 %118, i8* %120
%121 = load i8*, i8** %4
%122 = getelementptr inbounds i8, i8* %121, i64 3
%123 = load i8, i8* %122
%124 = load i8*, i8** %5
%125 = getelementptr inbounds i8, i8* %124, i64 3
%126 = load i8, i8* %125
%127 = call zeroext i8 @bd(i8 zeroext %123, i8 zeroext %126)
%128 = zext i8 %127 to i32
%129 = load i8*, i8** %4
%130 = getelementptr inbounds i8, i8* %129, i64 0
%131 = load i8, i8* %130
%132 = load i8*, i8** %5
%133 = getelementptr inbounds i8, i8* %132, i64 2
%134 = load i8, i8* %133
%135 = call zeroext i8 @bd(i8 zeroext %131, i8 zeroext %134)
%136 = zext i8 %135 to i32
%137 = xor i32 %128, %136
%138 = load i8*, i8** %4
%139 = getelementptr inbounds i8, i8* %138, i64 1
%140 = load i8, i8* %139
%141 = load i8*, i8** %5
%142 = getelementptr inbounds i8, i8* %141, i64 1
%143 = load i8, i8* %142
%144 = call zeroext i8 @bd(i8 zeroext %140, i8 zeroext %143)
%145 = zext i8 %144 to i32
%146 = xor i32 %137, %145
%147 = load i8*, i8** %4
%148 = getelementptr inbounds i8, i8* %147, i64 2
%149 = load i8, i8* %148
%150 = load i8*, i8** %5
%151 = getelementptr inbounds i8, i8* %150, i64 0
%152 = load i8, i8* %151
%153 = call zeroext i8 @bd(i8 zeroext %149, i8 zeroext %152)
%154 = zext i8 %153 to i32
%155 = xor i32 %146, %154
%156 = trunc i32 %155 to i8
%157 = load i8*, i8** %6
%158 = getelementptr inbounds i8, i8* %157, i64 3
store i8 %156, i8* %158
ret void
}

LLVM IR (-O2):
define void @modprod(i8* nocapture %0, i8* nocapture %1, i8* nocapture writeonly %2) {
%4 = load i8, i8* %0
%5 = getelementptr inbounds i8, i8* %1, i64 3
%6 = load i8, i8* %5
%7 = tail call zeroext i8 @bd(i8 zeroext %4, i8 zeroext %6)
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %1, i64 2
%11 = load i8, i8* %10
%12 = tail call zeroext i8 @bd(i8 zeroext %9, i8 zeroext %11)
%13 = xor i8 %12, %7
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %1, i64 1
%17 = load i8, i8* %16
%18 = tail call zeroext i8 @bd(i8 zeroext %15, i8 zeroext %17)
%19 = xor i8 %13, %18
%20 = getelementptr inbounds i8, i8* %0, i64 3
%21 = load i8, i8* %20
%22 = load i8, i8* %1
%23 = tail call zeroext i8 @bd(i8 zeroext %21, i8 zeroext %22)
%24 = xor i8 %19, %23
store i8 %24, i8* %2
%25 = load i8, i8* %8
%26 = load i8, i8* %5
%27 = tail call zeroext i8 @bd(i8 zeroext %25, i8 zeroext %26)
%28 = load i8, i8* %14
%29 = load i8, i8* %10
%30 = tail call zeroext i8 @bd(i8 zeroext %28, i8 zeroext %29)
%31 = xor i8 %30, %27
%32 = load i8, i8* %20
%33 = load i8, i8* %16
%34 = tail call zeroext i8 @bd(i8 zeroext %32, i8 zeroext %33)
%35 = xor i8 %31, %34
%36 = load i8, i8* %0
%37 = load i8, i8* %1
%38 = tail call zeroext i8 @bd(i8 zeroext %36, i8 zeroext %37)
%39 = xor i8 %35, %38
%40 = getelementptr inbounds i8, i8* %2, i64 1
store i8 %39, i8* %40
%41 = load i8, i8* %14
%42 = load i8, i8* %5
%43 = tail call zeroext i8 @bd(i8 zeroext %41, i8 zeroext %42)
%44 = load i8, i8* %20
%45 = load i8, i8* %10
%46 = tail call zeroext i8 @bd(i8 zeroext %44, i8 zeroext %45)
%47 = xor i8 %46, %43
%48 = load i8, i8* %0
%49 = load i8, i8* %16
%50 = tail call zeroext i8 @bd(i8 zeroext %48, i8 zeroext %49)
%51 = xor i8 %47, %50
%52 = load i8, i8* %8
%53 = load i8, i8* %1
%54 = tail call zeroext i8 @bd(i8 zeroext %52, i8 zeroext %53)
%55 = xor i8 %51, %54
%56 = getelementptr inbounds i8, i8* %2, i64 2
store i8 %55, i8* %56
%57 = load i8, i8* %20
%58 = load i8, i8* %5
%59 = tail call zeroext i8 @bd(i8 zeroext %57, i8 zeroext %58)
%60 = load i8, i8* %0
%61 = load i8, i8* %10
%62 = tail call zeroext i8 @bd(i8 zeroext %60, i8 zeroext %61)
%63 = xor i8 %62, %59
%64 = load i8, i8* %8
%65 = load i8, i8* %16
%66 = tail call zeroext i8 @bd(i8 zeroext %64, i8 zeroext %65)
%67 = xor i8 %63, %66
%68 = load i8, i8* %14
%69 = load i8, i8* %1
%70 = tail call zeroext i8 @bd(i8 zeroext %68, i8 zeroext %69)
%71 = xor i8 %67, %70
%72 = getelementptr inbounds i8, i8* %2, i64 3
store i8 %71, i8* %72
ret void
}