#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 ntime(unsigned char);
unsigned char inproduct(unsigned char x, unsigned char y) {
  unsigned char mask;
  unsigned char p = 0;
  for (mask = 0x01; mask; mask <<= 1) {
    if (y & mask) {
      p ^= x;
    }
    x = ntime(x);
  }
  return p;
}


x86 assembly (clang, -O0):
<inproduct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x0,-0x4(%rbp)
movb   $0x1,-0x3(%rbp)
cmpb   $0x0,-0x3(%rbp)
je     1171 <inproduct+0x61>
movzbl -0x2(%rbp),%eax
movzbl -0x3(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1156 <inproduct+0x46>
movzbl -0x1(%rbp),%ecx
movzbl -0x4(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x4(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <ntime@plt>
mov    %al,-0x1(%rbp)
movzbl -0x3(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x3(%rbp)
jmp    112c <inproduct+0x1c>
movzbl -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inproduct>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %r14d,%ebp
and    $0x1,%bpl
neg    %bpl
and    %dil,%bpl
call   1030 <ntime@plt>
mov    %r14d,%ebx
shl    $0x6,%bl
sar    $0x7,%bl
and    %al,%bl
xor    %bpl,%bl
movzbl %al,%edi
call   1030 <ntime@plt>
mov    %r14d,%ebp
shl    $0x5,%bpl
sar    $0x7,%bpl
and    %al,%bpl
xor    %bl,%bpl
movzbl %al,%edi
call   1030 <ntime@plt>
mov    %r14d,%ebx
shl    $0x4,%bl
sar    $0x7,%bl
and    %al,%bl
xor    %bpl,%bl
movzbl %al,%edi
call   1030 <ntime@plt>
lea    0x0(,%r14,8),%ebp
sar    $0x7,%bpl
and    %al,%bpl
xor    %bl,%bpl
movzbl %al,%edi
call   1030 <ntime@plt>
lea    0x0(,%r14,4),%ebx
sar    $0x7,%bl
and    %al,%bl
xor    %bpl,%bl
movzbl %al,%edi
call   1030 <ntime@plt>
lea    (%r14,%r14,1),%ebp
sar    $0x7,%bpl
and    %al,%bpl
xor    %bl,%bpl
movzbl %al,%edi
call   1030 <ntime@plt>
sar    $0x7,%r14b
and    %al,%r14b
xor    %bpl,%r14b
movzbl %al,%edi
call   1030 <ntime@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @inproduct(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
store i8 0, i8* %6
store i8 1, i8* %5
br label %7
7: ; preds = %27, %2
%8 = load i8, i8* %5
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = and i32 %12, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %10
%18 = load i8, i8* %3
%19 = zext i8 %18 to i32
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = xor i32 %21, %19
%23 = trunc i32 %22 to i8
store i8 %23, i8* %6
br label %24
24: ; preds = %17, %10
%25 = load i8, i8* %3
%26 = call zeroext i8 @ntime(i8 zeroext %25)
store i8 %26, i8* %3
br label %27
27: ; preds = %24
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = shl i32 %29, 1
%31 = trunc i32 %30 to i8
store i8 %31, i8* %5
br label %7
32: ; preds = %7
%33 = load i8, i8* %6
ret i8 %33
}

LLVM IR (-O2):
define zeroext i8 @inproduct(i8 zeroext %0, i8 zeroext %1) {
%3 = and i8 %1, 1
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i8 0, i8 %0
%6 = tail call zeroext i8 @ntime(i8 zeroext %0)
%7 = and i8 %1, 2
%8 = icmp eq i8 %7, 0
%9 = select i1 %8, i8 0, i8 %6
%10 = xor i8 %9, %5
%11 = tail call zeroext i8 @ntime(i8 zeroext %6)
%12 = and i8 %1, 4
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8 0, i8 %11
%15 = xor i8 %14, %10
%16 = tail call zeroext i8 @ntime(i8 zeroext %11)
%17 = and i8 %1, 8
%18 = icmp eq i8 %17, 0
%19 = select i1 %18, i8 0, i8 %16
%20 = xor i8 %19, %15
%21 = tail call zeroext i8 @ntime(i8 zeroext %16)
%22 = and i8 %1, 16
%23 = icmp eq i8 %22, 0
%24 = select i1 %23, i8 0, i8 %21
%25 = xor i8 %24, %20
%26 = tail call zeroext i8 @ntime(i8 zeroext %21)
%27 = and i8 %1, 32
%28 = icmp eq i8 %27, 0
%29 = select i1 %28, i8 0, i8 %26
%30 = xor i8 %29, %25
%31 = tail call zeroext i8 @ntime(i8 zeroext %26)
%32 = and i8 %1, 64
%33 = icmp eq i8 %32, 0
%34 = select i1 %33, i8 0, i8 %31
%35 = xor i8 %34, %30
%36 = tail call zeroext i8 @ntime(i8 zeroext %31)
%37 = icmp slt i8 %1, 0
%38 = select i1 %37, i8 %36, i8 0
%39 = xor i8 %38, %35
%40 = tail call zeroext i8 @ntime(i8 zeroext %36)
ret i8 %39
}