#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ clock_r(int *, int, int);
int /*<<< orphan*/ clock_s(int *, int, int);
void clock_kg(uint8_t *r, uint8_t *s, uint8_t mixing, uint8_t input) {
  uint8_t rb, sb;
  rb = ((s[54 / 8]) >> ((54 % 8))) ^ ((r[106 / 8]) >> (((106 % 8))));
  sb = ((s[106 / 8]) >> ((106 % 8))) ^ ((r[53 / 8]) >> (((53 % 8))));
  rb &= 1;
  sb &= 1;
  mixing = input ^ (mixing & ((s[80 / 8] >> ((80 % 8))) & 1));
  clock_r(r, mixing, rb);
  clock_s(s, input, sb);
}


x86 assembly (clang, -O0):
<clock_kg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
sar    $0x6,%eax
mov    -0x8(%rbp),%rcx
mov    0x34(%rcx),%ecx
sar    $0x2,%ecx
xor    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x34(%rax),%eax
sar    $0x2,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%ecx
sar    $0x5,%ecx
xor    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rdx
mov    0x28(%rdx),%edx
sar    $0x0,%edx
and    $0x1,%edx
and    %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <clock_r@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1030 <clock_s@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_kg>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    0x18(%rsi),%ecx
mov    0x34(%rsi),%esi
shr    $0x6,%ecx
mov    0x18(%rdi),%ebp
mov    0x34(%rdi),%eax
shr    $0x2,%eax
xor    %ecx,%eax
shr    $0x2,%esi
shr    $0x5,%ebp
xor    %esi,%ebp
and    $0x1,%eax
and    $0x1,%ebp
and    0x28(%rbx),%edx
and    $0x1,%edx
xor    %r14d,%edx
mov    %edx,%esi
mov    %eax,%edx
call   1040 <clock_r@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <clock_s@plt>

LLVM IR (-O0):
define void @clock_kg(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32*, i32** %6
%12 = getelementptr inbounds i32, i32* %11, i64 6
%13 = load i32, i32* %12
%14 = ashr i32 %13, 6
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 13
%17 = load i32, i32* %16
%18 = ashr i32 %17, 2
%19 = xor i32 %14, %18
store i32 %19, i32* %9
%20 = load i32*, i32** %6
%21 = getelementptr inbounds i32, i32* %20, i64 13
%22 = load i32, i32* %21
%23 = ashr i32 %22, 2
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 6
%26 = load i32, i32* %25
%27 = ashr i32 %26, 5
%28 = xor i32 %23, %27
store i32 %28, i32* %10
%29 = load i32, i32* %9
%30 = and i32 %29, 1
store i32 %30, i32* %9
%31 = load i32, i32* %10
%32 = and i32 %31, 1
store i32 %32, i32* %10
%33 = load i32, i32* %8
%34 = load i32, i32* %7
%35 = load i32*, i32** %6
%36 = getelementptr inbounds i32, i32* %35, i64 10
%37 = load i32, i32* %36
%38 = ashr i32 %37, 0
%39 = and i32 %38, 1
%40 = and i32 %34, %39
%41 = xor i32 %33, %40
store i32 %41, i32* %7
%42 = load i32*, i32** %5
%43 = load i32, i32* %7
%44 = load i32, i32* %9
%45 = call i32 @clock_r(i32* %42, i32 %43, i32 %44)
%46 = load i32*, i32** %6
%47 = load i32, i32* %8
%48 = load i32, i32* %10
%49 = call i32 @clock_s(i32* %46, i32 %47, i32 %48)
ret void
}

LLVM IR (-O2):
define void @clock_kg(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = getelementptr inbounds i32, i32* %1, i64 6
%6 = load i32, i32* %5
%7 = lshr i32 %6, 6
%8 = getelementptr inbounds i32, i32* %0, i64 13
%9 = load i32, i32* %8
%10 = lshr i32 %9, 2
%11 = xor i32 %10, %7
%12 = getelementptr inbounds i32, i32* %1, i64 13
%13 = load i32, i32* %12
%14 = lshr i32 %13, 2
%15 = getelementptr inbounds i32, i32* %0, i64 6
%16 = load i32, i32* %15
%17 = lshr i32 %16, 5
%18 = xor i32 %17, %14
%19 = and i32 %11, 1
%20 = and i32 %18, 1
%21 = getelementptr inbounds i32, i32* %1, i64 10
%22 = load i32, i32* %21
%23 = and i32 %2, 1
%24 = and i32 %23, %22
%25 = xor i32 %24, %3
%26 = tail call i32 @clock_r(i32* %0, i32 %25, i32 %19)
%27 = tail call i32 @clock_s(i32* %1, i32 %3, i32 %20)
ret void
}