#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 lvalue {
  int dummy;
};

/* Variables and functions */
scalar_t__ dbltest(struct lvalue *, struct lvalue *);
int /*<<< orphan*/ gen_multiply_by_two();
int /*<<< orphan*/ gen_pop();
int /*<<< orphan*/ gen_swap();
int /*<<< orphan*/ output_line(char *);
void gen_add(struct lvalue *lval, struct lvalue *lval2) {
  gen_pop();
  if (dbltest(lval2, lval)) {
    gen_swap();
    gen_multiply_by_two();
    gen_swap();
  }
  output_line("add hl,de");
}


x86 assembly (clang, -O0):
<gen_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <gen_pop@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <dbltest@plt>
cmp    $0x0,%rax
je     1193 <gen_add+0x43>
mov    $0x0,%al
call   1040 <gen_swap@plt>
mov    $0x0,%al
call   1060 <gen_multiply_by_two@plt>
mov    $0x0,%al
call   1040 <gen_swap@plt>
lea    0xe66(%rip),%rdi
call   1050 <output_line@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <gen_pop@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <dbltest@plt>
test   %rax,%rax
je     1186 <gen_add+0x36>
xor    %eax,%eax
call   1040 <gen_swap@plt>
xor    %eax,%eax
call   1060 <gen_multiply_by_two@plt>
xor    %eax,%eax
call   1040 <gen_swap@plt>
lea    0xe73(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <output_line@plt>

LLVM IR (-O0):
%struct.lvalue = type { i32 }
@.str = [10 x i8] c"add hl,de\00"
define void @gen_add(%struct.lvalue* %0, %struct.lvalue* %1) {
%3 = alloca %struct.lvalue*
%4 = alloca %struct.lvalue*
store %struct.lvalue* %0, %struct.lvalue** %3
store %struct.lvalue* %1, %struct.lvalue** %4
%5 = call i32 (...) @gen_pop()
%6 = load %struct.lvalue*, %struct.lvalue** %4
%7 = load %struct.lvalue*, %struct.lvalue** %3
%8 = call i64 @dbltest(%struct.lvalue* %6, %struct.lvalue* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 (...) @gen_swap()
%12 = call i32 (...) @gen_multiply_by_two()
%13 = call i32 (...) @gen_swap()
br label %14
14: ; preds = %10, %2
%15 = call i32 @output_line(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.lvalue = type { i32 }
@.str = [10 x i8] c"add hl,de\00"
define void @gen_add(%struct.lvalue* %0, %struct.lvalue* %1) {
%3 = tail call i32 (...) @gen_pop()
%4 = tail call i64 @dbltest(%struct.lvalue* %1, %struct.lvalue* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 (...) @gen_swap()
%8 = tail call i32 (...) @gen_multiply_by_two()
%9 = tail call i32 (...) @gen_swap()
br label %10
10: ; preds = %6, %2
%11 = tail call i32 @output_line(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}