#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*/ off(int);
int /*<<< orphan*/ on(int);
int /*<<< orphan*/ pulse(int);
void shift(int data_pin, int clock_pin, int latch_pin, unsigned int data) {
  unsigned int i = 0;
  for (; i < 8; i++) {
    off(data_pin);
    if (data & (1 << (7 - i))) {
      on(data_pin);
    }
    pulse(clock_pin);
  }
  pulse(latch_pin);
}


x86 assembly (clang, -O0):
<shift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jae    119a <shift+0x6a>
mov    -0x4(%rbp),%edi
call   1040 <off@plt>
mov    -0x10(%rbp),%eax
mov    $0x7,%ecx
sub    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1184 <shift+0x54>
mov    -0x4(%rbp),%edi
call   1050 <on@plt>
mov    -0x8(%rbp),%edi
call   1030 <pulse@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <shift+0x1b>
mov    -0xc(%rbp),%edi
call   1030 <pulse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
call   1040 <off@plt>
test   $0x80,%bpl
je     1153 <shift+0x23>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x40,%bpl
je     116f <shift+0x3f>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x20,%bpl
je     118b <shift+0x5b>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x10,%bpl
je     11a7 <shift+0x77>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x8,%bpl
je     11c3 <shift+0x93>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x4,%bpl
je     11df <shift+0xaf>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x2,%bpl
je     11fb <shift+0xcb>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %ebx,%edi
call   1040 <off@plt>
test   $0x1,%bpl
je     1217 <shift+0xe7>
mov    %ebx,%edi
call   1050 <on@plt>
mov    %r15d,%edi
call   1030 <pulse@plt>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <pulse@plt>

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

LLVM IR (-O2):
define void @shift(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @off(i32 %0)
%6 = and i32 %3, 128
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @on(i32 %0)
br label %10
10: ; preds = %8, %4
%11 = tail call i32 @pulse(i32 %1)
%12 = tail call i32 @off(i32 %0)
%13 = and i32 %3, 64
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = tail call i32 @on(i32 %0)
br label %17
17: ; preds = %15, %10
%18 = tail call i32 @pulse(i32 %1)
%19 = tail call i32 @off(i32 %0)
%20 = and i32 %3, 32
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = tail call i32 @on(i32 %0)
br label %24
24: ; preds = %22, %17
%25 = tail call i32 @pulse(i32 %1)
%26 = tail call i32 @off(i32 %0)
%27 = and i32 %3, 16
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = tail call i32 @on(i32 %0)
br label %31
31: ; preds = %29, %24
%32 = tail call i32 @pulse(i32 %1)
%33 = tail call i32 @off(i32 %0)
%34 = and i32 %3, 8
%35 = icmp eq i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %31
%37 = tail call i32 @on(i32 %0)
br label %38
38: ; preds = %36, %31
%39 = tail call i32 @pulse(i32 %1)
%40 = tail call i32 @off(i32 %0)
%41 = and i32 %3, 4
%42 = icmp eq i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %38
%44 = tail call i32 @on(i32 %0)
br label %45
45: ; preds = %43, %38
%46 = tail call i32 @pulse(i32 %1)
%47 = tail call i32 @off(i32 %0)
%48 = and i32 %3, 2
%49 = icmp eq i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %45
%51 = tail call i32 @on(i32 %0)
br label %52
52: ; preds = %50, %45
%53 = tail call i32 @pulse(i32 %1)
%54 = tail call i32 @off(i32 %0)
%55 = and i32 %3, 1
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %52
%58 = tail call i32 @on(i32 %0)
br label %59
59: ; preds = %57, %52
%60 = tail call i32 @pulse(i32 %1)
%61 = tail call i32 @pulse(i32 %2)
ret void
}