int half_shape(c)
int c;
{
  if (A_is_a(c))
    return chg_c_a2i(c);
  if (A_is_valid(c) && A_is_f(c))
    return chg_c_f2m(c);
  return 0;
}


x86 assembly (clang, -O0):
<half_shape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <A_is_a@plt>
cmp    $0x0,%eax
je     1180 <half_shape+0x30>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1070 <chg_c_a2i@plt>
mov    %eax,-0x4(%rbp)
jmp    11bf <half_shape+0x6f>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1050 <A_is_valid@plt>
cmp    $0x0,%eax
je     11b8 <half_shape+0x68>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1060 <A_is_f@plt>
cmp    $0x0,%eax
je     11b8 <half_shape+0x68>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <chg_c_f2m@plt>
mov    %eax,-0x4(%rbp)
jmp    11bf <half_shape+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<half_shape>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <A_is_a@plt>
test   %eax,%eax
je     1168 <half_shape+0x18>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1070 <chg_c_a2i@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <A_is_valid@plt>
test   %eax,%eax
je     118c <half_shape+0x3c>
mov    %ebx,%edi
xor    %eax,%eax
call   1060 <A_is_f@plt>
test   %eax,%eax
je     118c <half_shape+0x3c>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <chg_c_f2m@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @half_shape(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i32, ...) bitcast (i32 (...)* @A_is_a to i32 (i32, ...)*)(i32 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i32 (i32, ...) bitcast (i32 (...)* @chg_c_a2i to i32 (i32, ...)*)(i32 %8)
store i32 %9, i32* %2
br label %22
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 (i32, ...) bitcast (i32 (...)* @A_is_valid to i32 (i32, ...)*)(i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* %3
%16 = call i32 (i32, ...) bitcast (i32 (...)* @A_is_f to i32 (i32, ...)*)(i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i32 (i32, ...) bitcast (i32 (...)* @chg_c_f2m to i32 (i32, ...)*)(i32 %19)
store i32 %20, i32* %2
br label %22
21: ; preds = %14, %10
store i32 0, i32* %2
br label %22
22: ; preds = %21, %18, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @half_shape(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @A_is_a to i32 (i32, ...)*)(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @chg_c_a2i to i32 (i32, ...)*)(i32 %0)
br label %14
6: ; preds = %1
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @A_is_valid to i32 (i32, ...)*)(i32 %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @A_is_f to i32 (i32, ...)*)(i32 %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @chg_c_f2m to i32 (i32, ...)*)(i32 %0)
br label %14
14: ; preds = %6, %9, %12, %4
%15 = phi i32 [ %5, %4 ], [ %13, %12 ], [ 0, %9 ], [ 0, %6 ]
ret i32 %15
}