#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 pasm_program {
  int dummy;
};
struct pasm_label {
  int dummy;
};
struct pasm_instr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pasm_program_add_instr(struct pasm_program *,
                                          struct pasm_instr *);
int /*<<< orphan*/ pasm_program_add_label(struct pasm_program *,
                                          struct pasm_label *);
struct pasm_instr *pasm_translate_instr_line(char *);
struct pasm_label *pasm_translate_label_line(char *);
void pasm_program_add_line(struct pasm_program *prog, char *line) {
  struct pasm_instr *instr = NULL;
  struct pasm_label *label = NULL;
  label = pasm_translate_label_line(line);
  if (label) {
    pasm_program_add_label(prog, label);
  } else {
    instr = pasm_translate_instr_line(line);
    if (instr) {
      pasm_program_add_instr(prog, instr);
    }
  }
}


x86 assembly (clang, -O0):
<pasm_program_add_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <pasm_translate_label_line@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     118a <pasm_program_add_line+0x4a>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <pasm_program_add_label@plt>
jmp    11b4 <pasm_program_add_line+0x74>
mov    -0x10(%rbp),%rdi
call   1030 <pasm_translate_instr_line@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11af <pasm_program_add_line+0x6f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <pasm_program_add_instr@plt>
jmp    11b4 <pasm_program_add_line+0x74>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pasm_program_add_line>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <pasm_translate_label_line@plt>
test   %rax,%rax
je     1169 <pasm_program_add_line+0x29>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <pasm_program_add_label@plt>
mov    %rbx,%rdi
call   1030 <pasm_translate_instr_line@plt>
test   %rax,%rax
je     1188 <pasm_program_add_line+0x48>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <pasm_program_add_instr@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.pasm_program = type { i32 }
%struct.pasm_instr = type { i32 }
%struct.pasm_label = type { i32 }
define void @pasm_program_add_line(%struct.pasm_program* %0, i8* %1) {
%3 = alloca %struct.pasm_program*
%4 = alloca i8*
%5 = alloca %struct.pasm_instr*
%6 = alloca %struct.pasm_label*
store %struct.pasm_program* %0, %struct.pasm_program** %3
store i8* %1, i8** %4
store %struct.pasm_instr* null, %struct.pasm_instr** %5
store %struct.pasm_label* null, %struct.pasm_label** %6
%7 = load i8*, i8** %4
%8 = call %struct.pasm_label* @pasm_translate_label_line(i8* %7)
store %struct.pasm_label* %8, %struct.pasm_label** %6
%9 = load %struct.pasm_label*, %struct.pasm_label** %6
%10 = icmp ne %struct.pasm_label* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load %struct.pasm_program*, %struct.pasm_program** %3
%13 = load %struct.pasm_label*, %struct.pasm_label** %6
%14 = call i32 @pasm_program_add_label(%struct.pasm_program* %12, %struct.pasm_label* %13)
br label %25
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call %struct.pasm_instr* @pasm_translate_instr_line(i8* %16)
store %struct.pasm_instr* %17, %struct.pasm_instr** %5
%18 = load %struct.pasm_instr*, %struct.pasm_instr** %5
%19 = icmp ne %struct.pasm_instr* %18, null
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load %struct.pasm_program*, %struct.pasm_program** %3
%22 = load %struct.pasm_instr*, %struct.pasm_instr** %5
%23 = call i32 @pasm_program_add_instr(%struct.pasm_program* %21, %struct.pasm_instr* %22)
br label %24
24: ; preds = %20, %15
br label %25
25: ; preds = %24, %11
ret void
}

LLVM IR (-O2):
%struct.pasm_program = type { i32 }
%struct.pasm_instr = type { i32 }
%struct.pasm_label = type { i32 }
define void @pasm_program_add_line(%struct.pasm_program* %0, i8* %1) {
%3 = tail call %struct.pasm_label* @pasm_translate_label_line(i8* %1)
%4 = icmp eq %struct.pasm_label* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @pasm_program_add_label(%struct.pasm_program* %0, %struct.pasm_label* %3)
br label %12
7: ; preds = %2
%8 = tail call %struct.pasm_instr* @pasm_translate_instr_line(i8* %1)
%9 = icmp eq %struct.pasm_instr* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @pasm_program_add_instr(%struct.pasm_program* %0, %struct.pasm_instr* %8)
br label %12
12: ; preds = %7, %10, %5
ret void
}