#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 a_co();
int a_fo();
int archive_write_set_options(void) {
  int r1, r2;
  r1 = a_fo();
  if (r1 < -20)
    return r1;
  r2 = a_co();
  if (r2 < -20)
    return r2;
  if (r1 == -20 && r2 == -20)
    return -20;
  return 0;
}


x86 assembly (clang, -O0):
<archive_write_set_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <a_fo@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffec,-0x8(%rbp)
jge    1147 <archive_write_set_options+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <archive_write_set_options+0x6d>
mov    $0x0,%al
call   1040 <a_co@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffec,-0xc(%rbp)
jge    1166 <archive_write_set_options+0x46>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <archive_write_set_options+0x6d>
cmpl   $0xffffffec,-0x8(%rbp)
jne    1186 <archive_write_set_options+0x66>
cmpl   $0xffffffec,-0xc(%rbp)
jne    1186 <archive_write_set_options+0x66>
movl   $0xffffffec,-0x4(%rbp)
jmp    118d <archive_write_set_options+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<archive_write_set_options>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <a_fo@plt>
cmp    $0xffffffec,%eax
jl     1151 <archive_write_set_options+0x31>
mov    %eax,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <a_co@plt>
cmp    $0xffffffec,%eax
jl     1151 <archive_write_set_options+0x31>
xor    $0xffffffec,%ebx
xor    $0xffffffec,%eax
or     %ebx,%eax
mov    $0xffffffec,%eax
cmove  %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @archive_write_set_options() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @a_fo()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, -20
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = load i32, i32* %2
store i32 %8, i32* %1
br label %23
9: ; preds = %0
%10 = call i32 (...) @a_co()
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, -20
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* %3
store i32 %14, i32* %1
br label %23
15: ; preds = %9
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, -20
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, -20
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 -20, i32* %1
br label %23
22: ; preds = %18, %15
store i32 0, i32* %1
br label %23
23: ; preds = %22, %21, %13, %7
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
define i32 @archive_write_set_options() {
%1 = tail call i32 (...) @a_fo()
%2 = icmp slt i32 %1, -20
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = tail call i32 (...) @a_co()
%5 = icmp slt i32 %4, -20
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = icmp eq i32 %1, -20
%8 = icmp eq i32 %4, -20
%9 = select i1 %7, i1 %8, i1 false
%10 = select i1 %9, i32 -20, i32 0
br label %11
11: ; preds = %6, %3, %0
%12 = phi i32 [ %1, %0 ], [ %4, %3 ], [ %10, %6 ]
ret i32 %12
}