#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 get_bit(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int verschuif_cyclisch(int, int);
int main(void) {
  for (int j = -7; j <= 7; j++) {
    printf("%2d ", j);
    int ch = 42;
    ch = verschuif_cyclisch(ch, j);
    for (int i = 0; i < 8; i++) {
      printf("%d", get_bit(ch, i));
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffff9,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jg     11d4 <main+0x94>
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
movl   $0x2a,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <verschuif_cyclisch@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11bc <main+0x7c>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <get_bit@plt>
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118b <main+0x4b>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xfffffff9,%ebx
lea    0xead(%rip),%r14
lea    0xeab(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    $0x2a,%edi
mov    %ebx,%esi
call   1050 <verschuif_cyclisch@plt>
mov    %eax,%ebp
mov    %eax,%edi
xor    %esi,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x6,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x7,%esi
call   1060 <get_bit@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x8,%ebx
jne    1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%2d \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 -7, i32* %2
br label %5
5: ; preds = %27, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 7
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 42, i32* %3
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = call i32 @verschuif_cyclisch(i32 %11, i32 %12)
store i32 %13, i32* %3
store i32 0, i32* %4
br label %14
14: ; preds = %22, %8
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 8
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @get_bit(i32 %18, i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %14
25: ; preds = %14
%26 = call i32 @putchar(i8 signext 10)
br label %27
27: ; preds = %25
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %5
30: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%2d \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ -7, %0 ], [ %23, %2 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @verschuif_cyclisch(i32 42, i32 %3)
%6 = tail call i32 @get_bit(i32 %5, i32 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @get_bit(i32 %5, i32 1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 @get_bit(i32 %5, i32 2)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 @get_bit(i32 %5, i32 3)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @get_bit(i32 %5, i32 4)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i32 @get_bit(i32 %5, i32 5)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 @get_bit(i32 %5, i32 6)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = tail call i32 @get_bit(i32 %5, i32 7)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = tail call i32 @putchar(i8 signext 10)
%23 = add nsw i32 %3, 1
%24 = icmp eq i32 %23, 8
br i1 %24, label %1, label %2
}