#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 char int32_t;
typedef char int16_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, long, long, long, long, long,
                            long);
char *_access_alignment_check_(char *buf, int buf_len) {
  typedef struct {
    char a;
    char b;
    int16_t c;
    int16_t d;
    int32_t e;
  } A;
  typedef struct {
    char a;
    int16_t b;
    int32_t c;
  } B;
  A a;
  B b;
  char *base_a = &a.a;
  char *a_b_p = &a.b;
  char *a_c_p = (char *)&a.c;
  char *a_d_p = (char *)&a.d;
  char *a_e_p = (char *)&a.e;
  char *base_b = (char *)&b.a;
  char *b_b_p = (char *)&b.b;
  char *b_c_p = (char *)&b.c;
  snprintf(buf, buf_len, "a: %ld %ld %ld %ld; b:%ld %ld",
           (long)(a_b_p - base_a), (long)(a_c_p - base_a),
           (long)(a_d_p - base_a), (long)(a_e_p - base_a),
           (long)(b_b_p - base_b), (long)(b_c_p - base_b));
  return buf;
}


x86 assembly (clang, -O0):
<_access_alignment_check_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
lea    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
lea    -0x18(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x40(%rbp)
lea    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x48(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
lea    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rax
sub    %rax,%rcx
mov    -0x38(%rbp),%r8
mov    -0x28(%rbp),%rax
sub    %rax,%r8
mov    -0x40(%rbp),%r9
mov    -0x28(%rbp),%rax
sub    %rax,%r9
mov    -0x48(%rbp),%r11
mov    -0x28(%rbp),%rax
sub    %rax,%r11
mov    -0x58(%rbp),%r10
mov    -0x50(%rbp),%rax
sub    %rax,%r10
mov    -0x60(%rbp),%rax
mov    -0x50(%rbp),%rdx
sub    %rdx,%rax
lea    0xe36(%rip),%rdx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_access_alignment_check_>:
push   %rbx
mov    %rdi,%rbx
sub    $0x8,%rsp
lea    0xee1(%rip),%rdx
mov    $0x1,%ecx
mov    $0x2,%r8d
mov    $0x3,%r9d
push   $0x2
push   $0x1
push   $0x4
call   1030 <snprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.A = type { i8, i8, i8, i8, i8 }
%struct.B = type { i8, i8, i8 }
@.str = [30 x i8] c"a: %ld %ld %ld %ld; b:%ld %ld\00"
define i8* @_access_alignment_check_(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.A
%6 = alloca %struct.B
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%15 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 0
store i8* %15, i8** %7
%16 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 1
store i8* %16, i8** %8
%17 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 2
store i8* %17, i8** %9
%18 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 3
store i8* %18, i8** %10
%19 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 4
store i8* %19, i8** %11
%20 = getelementptr inbounds %struct.B, %struct.B* %6, i32 0, i32 0
store i8* %20, i8** %12
%21 = getelementptr inbounds %struct.B, %struct.B* %6, i32 0, i32 1
store i8* %21, i8** %13
%22 = getelementptr inbounds %struct.B, %struct.B* %6, i32 0, i32 2
store i8* %22, i8** %14
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = load i8*, i8** %8
%26 = load i8*, i8** %7
%27 = ptrtoint i8* %25 to i64
%28 = ptrtoint i8* %26 to i64
%29 = sub i64 %27, %28
%30 = load i8*, i8** %9
%31 = load i8*, i8** %7
%32 = ptrtoint i8* %30 to i64
%33 = ptrtoint i8* %31 to i64
%34 = sub i64 %32, %33
%35 = load i8*, i8** %10
%36 = load i8*, i8** %7
%37 = ptrtoint i8* %35 to i64
%38 = ptrtoint i8* %36 to i64
%39 = sub i64 %37, %38
%40 = load i8*, i8** %11
%41 = load i8*, i8** %7
%42 = ptrtoint i8* %40 to i64
%43 = ptrtoint i8* %41 to i64
%44 = sub i64 %42, %43
%45 = load i8*, i8** %13
%46 = load i8*, i8** %12
%47 = ptrtoint i8* %45 to i64
%48 = ptrtoint i8* %46 to i64
%49 = sub i64 %47, %48
%50 = load i8*, i8** %14
%51 = load i8*, i8** %12
%52 = ptrtoint i8* %50 to i64
%53 = ptrtoint i8* %51 to i64
%54 = sub i64 %52, %53
%55 = call i32 @snprintf(i8* %23, i32 %24, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %29, i64 %34, i64 %39, i64 %44, i64 %49, i64 %54)
%56 = load i8*, i8** %3
ret i8* %56
}

LLVM IR (-O2):
%struct.A = type { i8, i8, i8, i8, i8 }
%struct.B = type { i8, i8, i8 }
@.str = [30 x i8] c"a: %ld %ld %ld %ld; b:%ld %ld\00"
define i8* @_access_alignment_check_(i8* returned %0, i32 %1) {
%3 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 1, i64 2, i64 3, i64 4, i64 1, i64 2)
ret i8* %0
}