#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*/ fexpect(char *, int, int, int);
void bitfield_basic() {
  union {
    int i;
    struct {
      int a : 5;
      int b : 5;
    };
  } x;
  x.i = 0;
  x.a = 10;
  x.b = 11;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          209, 10, x.a);
  ;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          210, 11, x.b);
  ;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          211, 362, x.i);
  ;
}


x86 assembly (clang, -O0):
<bitfield_basic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%ax
and    $0xffe0,%ax
or     $0xa,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
and    $0xfc1f,%ax
or     $0x160,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
shl    $0xb,%ax
sar    $0xb,%ax
movswl %ax,%ecx
lea    0xeab(%rip),%rdi
mov    $0xd1,%esi
mov    $0xa,%edx
call   1030 <fexpect@plt>
mov    -0x8(%rbp),%ax
shl    $0x6,%ax
sar    $0xb,%ax
movswl %ax,%ecx
lea    0xe86(%rip),%rdi
mov    $0xd2,%esi
mov    $0xb,%edx
call   1030 <fexpect@plt>
mov    -0x8(%rbp),%ecx
lea    0xe6d(%rip),%rdi
mov    $0xd3,%esi
mov    $0x16a,%edx
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitfield_basic>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xd1,%esi
mov    $0xa,%edx
mov    $0xa,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xd2,%esi
mov    $0xb,%edx
mov    $0xb,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xd3,%esi
mov    $0x16a,%edx
mov    $0x16a,%ecx
pop    %rbx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
%union.anon = type { i32 }
%struct.anon = type { i16, [2 x i8] }
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c\00"
define void @bitfield_basic() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i32*
store i32 0, i32* %2
%3 = bitcast %union.anon* %1 to %struct.anon*
%4 = bitcast %struct.anon* %3 to i16*
%5 = load i16, i16* %4
%6 = and i16 %5, -32
%7 = or i16 %6, 10
store i16 %7, i16* %4
%8 = bitcast %union.anon* %1 to %struct.anon*
%9 = bitcast %struct.anon* %8 to i16*
%10 = load i16, i16* %9
%11 = and i16 %10, -993
%12 = or i16 %11, 352
store i16 %12, i16* %9
%13 = bitcast %union.anon* %1 to %struct.anon*
%14 = bitcast %struct.anon* %13 to i16*
%15 = load i16, i16* %14
%16 = shl i16 %15, 11
%17 = ashr i16 %16, 11
%18 = sext i16 %17 to i32
%19 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 209, i32 10, i32 %18)
%20 = bitcast %union.anon* %1 to %struct.anon*
%21 = bitcast %struct.anon* %20 to i16*
%22 = load i16, i16* %21
%23 = shl i16 %22, 6
%24 = ashr i16 %23, 11
%25 = sext i16 %24 to i32
%26 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 210, i32 11, i32 %25)
%27 = bitcast %union.anon* %1 to i32*
%28 = load i32, i32* %27
%29 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 211, i32 362, i32 %28)
ret void
}

LLVM IR (-O2):
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c\00"
define void @bitfield_basic() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 209, i32 10, i32 10)
%2 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 210, i32 11, i32 11)
%3 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 211, i32 362, i32 362)
ret void
}