#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 */
struct _asm_context {
  int dummy;
};

/* Variables and functions */
int eval_expression(struct _asm_context *, int *);
int parse_align(struct _asm_context *, int);
int /*<<< orphan*/ print_error(char *, struct _asm_context *);
int parse_align_bits(struct _asm_context *asm_context) {
  int num;
  if (eval_expression(asm_context, &num) == -1 || (num % 8) != 0) {
    print_error("align expects 16, 32, 64, 128, etc bits", asm_context);
    return -1;
  }
  num = num / 8;
  return parse_align(asm_context, num);
}


x86 assembly (clang, -O0):
<parse_align_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <eval_expression@plt>
cmp    $0xffffffff,%eax
je     1166 <parse_align_bits+0x36>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1182 <parse_align_bits+0x52>
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <print_error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    119f <parse_align_bits+0x6f>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <parse_align@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_align_bits>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rsi
call   1040 <eval_expression@plt>
cmp    $0xffffffff,%eax
je     114f <parse_align_bits+0x1f>
mov    0xc(%rsp),%eax
test   $0x7,%al
je     1165 <parse_align_bits+0x35>
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
call   1030 <print_error@plt>
mov    $0xffffffff,%eax
jmp    117c <parse_align_bits+0x4c>
lea    0x7(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x3,%esi
mov    %esi,0xc(%rsp)
mov    %rbx,%rdi
call   1050 <parse_align@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct._asm_context = type { i32 }
@.str = [40 x i8] c"align expects 16, 32, 64, 128, etc bits\00"
define i32 @parse_align_bits(%struct._asm_context* %0) {
%2 = alloca i32
%3 = alloca %struct._asm_context*
%4 = alloca i32
store %struct._asm_context* %0, %struct._asm_context** %3
%5 = load %struct._asm_context*, %struct._asm_context** %3
%6 = call i32 @eval_expression(%struct._asm_context* %5, i32* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* %4
%10 = srem i32 %9, 8
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8, %1
%13 = load %struct._asm_context*, %struct._asm_context** %3
%14 = call i32 @print_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), %struct._asm_context* %13)
store i32 -1, i32* %2
br label %21
15: ; preds = %8
%16 = load i32, i32* %4
%17 = sdiv i32 %16, 8
store i32 %17, i32* %4
%18 = load %struct._asm_context*, %struct._asm_context** %3
%19 = load i32, i32* %4
%20 = call i32 @parse_align(%struct._asm_context* %18, i32 %19)
store i32 %20, i32* %2
br label %21
21: ; preds = %15, %12
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct._asm_context = type { i32 }
@.str = [40 x i8] c"align expects 16, 32, 64, 128, etc bits\00"
define i32 @parse_align_bits(%struct._asm_context* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @eval_expression(%struct._asm_context* %0, i32* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = and i32 %7, 7
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6, %1
%11 = call i32 @print_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), %struct._asm_context* %0)
br label %15
12: ; preds = %6
%13 = sdiv i32 %7, 8
store i32 %13, i32* %2
%14 = call i32 @parse_align(%struct._asm_context* %0, i32 %13)
br label %15
15: ; preds = %12, %10
%16 = phi i32 [ -1, %10 ], [ %14, %12 ]
ret i32 %16
}