#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;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ bitfield;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ print_binary(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void test_anonymous_aligned_wide() {
  printf("\n===== test_anonymous_aligned_wide\n");
  struct {
    uint8_t a : 1;
    uint8_t : 1;
    uint8_t b : 1;
    uint8_t c : 1;
    uint8_t : 0;
    uint8_t opcode : 2;
  } bitfield;
  printf("Memory size occupied by bitfield : %lu bits\n", sizeof(bitfield) * 8);
  printf("Memory contents (initial): ");
  print_binary(*(uint32_t *)&bitfield, sizeof(bitfield) * 8);
  bitfield.a = 1;
  bitfield.b = 1;
  bitfield.c = 1;
  bitfield.opcode = 0b11;
  assert(bitfield.a == 1);
  assert(bitfield.b == 1);
  assert(bitfield.c == 1);
  assert(bitfield.opcode == 3);
  printf("Memory contents (set)    : ");
  print_binary(*(uint32_t *)&bitfield, sizeof(bitfield) * 8);
  bitfield.a = 0;
  bitfield.b = 0;
  bitfield.c = 0;
  bitfield.opcode = 0;
  assert(bitfield.a == 0);
  assert(bitfield.b == 0);
  assert(bitfield.c == 0);
  assert(bitfield.opcode == 0);
  printf("Memory contents (cleared): ");
  print_binary(*(uint32_t *)&bitfield, sizeof(bitfield) * 8);
}


x86 assembly (clang, -O0):
<test_anonymous_aligned_wide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x40,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0x40,%esi
call   1050 <print_binary@plt>
mov    -0x8(%rbp),%al
and    $0xfe,%al
or     $0x1,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xfb,%al
or     $0x4,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xf7,%al
or     $0x8,%al
mov    %al,-0x8(%rbp)
mov    -0x4(%rbp),%al
and    $0xfc,%al
or     $0x3,%al
mov    %al,-0x4(%rbp)
mov    -0x8(%rbp),%al
shl    $0x7,%al
sar    $0x7,%al
movsbl %al,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%al
shl    $0x5,%al
sar    $0x7,%al
movsbl %al,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%al
shl    $0x4,%al
sar    $0x7,%al
movsbl %al,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%al
shl    $0x6,%al
sar    $0x6,%al
movsbl %al,%eax
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0x40,%esi
call   1050 <print_binary@plt>
mov    -0x8(%rbp),%al
and    $0xfe,%al
or     $0x0,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xfb,%al
or     $0x0,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xf7,%al
or     $0x0,%al
mov    %al,-0x8(%rbp)
mov    -0x4(%rbp),%al
and    $0xfc,%al
or     $0x0,%al
mov    %al,-0x4(%rbp)
mov    -0x8(%rbp),%al
shl    $0x7,%al
sar    $0x7,%al
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%al
shl    $0x5,%al
sar    $0x7,%al
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%al
shl    $0x4,%al
sar    $0x7,%al
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%al
shl    $0x6,%al
sar    $0x6,%al
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0x40,%esi
call   1050 <print_binary@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anonymous_aligned_wide>:
push   %rax
lea    0xf39(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
mov    $0x40,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x40,%esi
call   1060 <print_binary@plt>
xor    %edi,%edi
call   1050 <assert@plt>
xor    %edi,%edi
call   1050 <assert@plt>
xor    %edi,%edi
call   1050 <assert@plt>
xor    %edi,%edi
call   1050 <assert@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xd,%edi
mov    $0x40,%esi
call   1060 <print_binary@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x40,%esi
pop    %rax
jmp    1060 <print_binary@plt>

LLVM IR (-O0):
%struct.anon = type { i8, [3 x i8], i8, [3 x i8] }
@.str = [36 x i8] c"\0A===== test_anonymous_aligned_wide\0A\00"
@.str.1 = [45 x i8] c"Memory size occupied by bitfield : %lu bits\0A\00"
@.str.2 = [28 x i8] c"Memory contents (initial): \00"
@.str.3 = [28 x i8] c"Memory contents (set) : \00"
@.str.4 = [28 x i8] c"Memory contents (cleared): \00"
define void @test_anonymous_aligned_wide() {
%1 = alloca %struct.anon
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i64 64)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%5 = bitcast %struct.anon* %1 to i32*
%6 = load i32, i32* %5
%7 = call i32 @print_binary(i32 %6, i32 64)
%8 = bitcast %struct.anon* %1 to i8*
%9 = load i8, i8* %8
%10 = and i8 %9, -2
%11 = or i8 %10, 1
store i8 %11, i8* %8
%12 = bitcast %struct.anon* %1 to i8*
%13 = load i8, i8* %12
%14 = and i8 %13, -5
%15 = or i8 %14, 4
store i8 %15, i8* %12
%16 = bitcast %struct.anon* %1 to i8*
%17 = load i8, i8* %16
%18 = and i8 %17, -9
%19 = or i8 %18, 8
store i8 %19, i8* %16
%20 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 2
%21 = load i8, i8* %20
%22 = and i8 %21, -4
%23 = or i8 %22, 3
store i8 %23, i8* %20
%24 = bitcast %struct.anon* %1 to i8*
%25 = load i8, i8* %24
%26 = shl i8 %25, 7
%27 = ashr i8 %26, 7
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 1
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = bitcast %struct.anon* %1 to i8*
%33 = load i8, i8* %32
%34 = shl i8 %33, 5
%35 = ashr i8 %34, 7
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 1
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = bitcast %struct.anon* %1 to i8*
%41 = load i8, i8* %40
%42 = shl i8 %41, 4
%43 = ashr i8 %42, 7
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 1
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 2
%49 = load i8, i8* %48
%50 = shl i8 %49, 6
%51 = ashr i8 %50, 6
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 3
%54 = zext i1 %53 to i32
%55 = call i32 @assert(i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%57 = bitcast %struct.anon* %1 to i32*
%58 = load i32, i32* %57
%59 = call i32 @print_binary(i32 %58, i32 64)
%60 = bitcast %struct.anon* %1 to i8*
%61 = load i8, i8* %60
%62 = and i8 %61, -2
%63 = or i8 %62, 0
store i8 %63, i8* %60
%64 = bitcast %struct.anon* %1 to i8*
%65 = load i8, i8* %64
%66 = and i8 %65, -5
%67 = or i8 %66, 0
store i8 %67, i8* %64
%68 = bitcast %struct.anon* %1 to i8*
%69 = load i8, i8* %68
%70 = and i8 %69, -9
%71 = or i8 %70, 0
store i8 %71, i8* %68
%72 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 2
%73 = load i8, i8* %72
%74 = and i8 %73, -4
%75 = or i8 %74, 0
store i8 %75, i8* %72
%76 = bitcast %struct.anon* %1 to i8*
%77 = load i8, i8* %76
%78 = shl i8 %77, 7
%79 = ashr i8 %78, 7
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 0
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = bitcast %struct.anon* %1 to i8*
%85 = load i8, i8* %84
%86 = shl i8 %85, 5
%87 = ashr i8 %86, 7
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 0
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = bitcast %struct.anon* %1 to i8*
%93 = load i8, i8* %92
%94 = shl i8 %93, 4
%95 = ashr i8 %94, 7
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 0
%98 = zext i1 %97 to i32
%99 = call i32 @assert(i32 %98)
%100 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 2
%101 = load i8, i8* %100
%102 = shl i8 %101, 6
%103 = ashr i8 %102, 6
%104 = sext i8 %103 to i32
%105 = icmp eq i32 %104, 0
%106 = zext i1 %105 to i32
%107 = call i32 @assert(i32 %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%109 = bitcast %struct.anon* %1 to i32*
%110 = load i32, i32* %109
%111 = call i32 @print_binary(i32 %110, i32 64)
ret void
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"Memory size occupied by bitfield : %lu bits\0A\00"
@.str.2 = [28 x i8] c"Memory contents (initial): \00"
@.str.3 = [28 x i8] c"Memory contents (set) : \00"
@.str.4 = [28 x i8] c"Memory contents (cleared): \00"
@str = [35 x i8] c"\0A===== test_anonymous_aligned_wide\00"
define void @test_anonymous_aligned_wide() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i64 64)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @print_binary(i32 0, i32 64)
%5 = tail call i32 @assert(i32 0)
%6 = tail call i32 @assert(i32 0)
%7 = tail call i32 @assert(i32 0)
%8 = tail call i32 @assert(i32 0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @print_binary(i32 13, i32 64)
%11 = tail call i32 @assert(i32 1)
%12 = tail call i32 @assert(i32 1)
%13 = tail call i32 @assert(i32 1)
%14 = tail call i32 @assert(i32 1)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%16 = tail call i32 @print_binary(i32 0, i32 64)
ret void
}