#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*/ free(struct foo *);
scalar_t__ malloc(size_t);
int main() {
  struct foo {
    int part1 : 8;
    int nothing : 1;
    int part2 : 5;
    int lots_more_nothing : 3;
    int some_padding;
    float some_more_nothing;
    double yet_more_nothing;
  };
  struct foo *q =
      (struct foo *)malloc(((size_t) & ((struct foo *)0)->some_more_nothing));
  q->nothing = 1;
  q->lots_more_nothing = (q->part1 == 13 && q->part2 == 7);
  free(q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
add    $0x8,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
or     $0x100,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x18,%ecx
sar    $0x18,%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x11(%rbp)
jne    1183 <main+0x63>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
shl    $0x12,%eax
sar    $0x1b,%eax
cmp    $0x7,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0x7,%edx
shl    $0xe,%edx
and    $0xfffe3fff,%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    (%rax),%ecx
mov    %ecx,%edx
and    $0x3eff,%edx
xor    %esi,%esi
cmp    $0xe0d,%edx
sete   %sil
shl    $0xe,%esi
and    $0xfffe3eff,%ecx
add    %esi,%ecx
add    $0x100,%ecx
mov    %ecx,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.foo = type { i24, i32, float, double }
%struct.foo.0 = type opaque
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.foo*
store i32 0, i32* %1
%3 = call i64 @malloc(i64 ptrtoint (float* getelementptr inbounds (%struct.foo, %struct.foo* null, i32 0, i32 2) to i64))
%4 = inttoptr i64 %3 to %struct.foo*
store %struct.foo* %4, %struct.foo** %2
%5 = load %struct.foo*, %struct.foo** %2
%6 = bitcast %struct.foo* %5 to i32*
%7 = load i32, i32* %6
%8 = and i32 %7, -257
%9 = or i32 %8, 256
store i32 %9, i32* %6
%10 = load %struct.foo*, %struct.foo** %2
%11 = bitcast %struct.foo* %10 to i32*
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = ashr i32 %13, 24
%15 = icmp eq i32 %14, 13
br i1 %15, label %16, label %23
16: ; preds = %0
%17 = load %struct.foo*, %struct.foo** %2
%18 = bitcast %struct.foo* %17 to i32*
%19 = load i32, i32* %18
%20 = shl i32 %19, 18
%21 = ashr i32 %20, 27
%22 = icmp eq i32 %21, 7
br label %23
23: ; preds = %16, %0
%24 = phi i1 [ false, %0 ], [ %22, %16 ]
%25 = zext i1 %24 to i32
%26 = load %struct.foo*, %struct.foo** %2
%27 = bitcast %struct.foo* %26 to i32*
%28 = load i32, i32* %27
%29 = and i32 %25, 7
%30 = shl i32 %29, 14
%31 = and i32 %28, -114689
%32 = or i32 %31, %30
store i32 %32, i32* %27
%33 = shl i32 %29, 29
%34 = ashr i32 %33, 29
%35 = load %struct.foo*, %struct.foo** %2
%36 = bitcast %struct.foo* %35 to %struct.foo.0*
%37 = call i32 @free(%struct.foo.0* %36)
ret i32 0
}

LLVM IR (-O2):
%struct.foo.0 = type opaque
define i32 @main() {
%1 = tail call i64 @malloc(i64 8)
%2 = inttoptr i64 %1 to i32*
%3 = load i32, i32* %2
%4 = and i32 %3, 16127
%5 = icmp eq i32 %4, 3597
%6 = select i1 %5, i32 16384, i32 0
%7 = and i32 %3, -114945
%8 = or i32 %7, %6
%9 = or i32 %8, 256
store i32 %9, i32* %2
%10 = inttoptr i64 %1 to %struct.foo.0*
%11 = tail call i32 @free(%struct.foo.0* %10)
ret i32 0
}