#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*/ write_float();
int /*<<< orphan*/ write_zero();
void write_to_system(uint8_t system) {
  int i;
  for (i = 0; i < 5; i++) {
    system &(1 << i) ? write_zero() : write_float();
  }
}


x86 assembly (clang, -O0):
<write_to_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1177 <write_to_system+0x57>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1162 <write_to_system+0x42>
mov    $0x0,%al
call   1030 <write_zero@plt>
jmp    1169 <write_to_system+0x49>
mov    $0x0,%al
call   1040 <write_float@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <write_to_system+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_system>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
test   $0x1,%bl
jne    1131 <write_to_system+0x11>
call   1040 <write_float@plt>
jmp    1136 <write_to_system+0x16>
call   1030 <write_zero@plt>
xor    %eax,%eax
test   $0x2,%bl
jne    1144 <write_to_system+0x24>
call   1040 <write_float@plt>
jmp    1149 <write_to_system+0x29>
call   1030 <write_zero@plt>
xor    %eax,%eax
test   $0x4,%bl
jne    1157 <write_to_system+0x37>
call   1040 <write_float@plt>
jmp    115c <write_to_system+0x3c>
call   1030 <write_zero@plt>
xor    %eax,%eax
test   $0x8,%bl
jne    116a <write_to_system+0x4a>
call   1040 <write_float@plt>
jmp    116f <write_to_system+0x4f>
call   1030 <write_zero@plt>
xor    %eax,%eax
test   $0x10,%bl
jne    117c <write_to_system+0x5c>
pop    %rbx
jmp    1040 <write_float@plt>
pop    %rbx
jmp    1030 <write_zero@plt>

LLVM IR (-O0):
define void @write_to_system(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = shl i32 1, %9
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 (...) @write_zero()
br label %17
15: ; preds = %7
%16 = call i32 (...) @write_float()
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
br label %19
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @write_to_system(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @write_zero()
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @write_float()
br label %8
8: ; preds = %4, %6
%9 = and i32 %0, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 (...) @write_zero()
br label %15
13: ; preds = %8
%14 = tail call i32 (...) @write_float()
br label %15
15: ; preds = %13, %11
%16 = and i32 %0, 4
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (...) @write_zero()
br label %22
20: ; preds = %15
%21 = tail call i32 (...) @write_float()
br label %22
22: ; preds = %20, %18
%23 = and i32 %0, 8
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 (...) @write_zero()
br label %29
27: ; preds = %22
%28 = tail call i32 (...) @write_float()
br label %29
29: ; preds = %27, %25
%30 = and i32 %0, 16
%31 = icmp eq i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = tail call i32 (...) @write_zero()
br label %36
34: ; preds = %29
%35 = tail call i32 (...) @write_float()
br label %36
36: ; preds = %34, %32
ret void
}