#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 /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void assemble_object_code(char *operand, char *opcode, char *address,
                          char *object_code) {
  int i;
  char bin[50];
  strcpy(object_code, opcode);
  strcat(object_code, address);
  i = strlen(opcode);
  if (opcode[i - 2] == ',' && (opcode[i - 1] == 'X' || opcode[i - 1] == 'x'))
    object_code[strlen(object_code) - 4] += 8;
}


x86 assembly (clang, -O0):
<assemble_object_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    11e3 <assemble_object_code+0xb3>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x58,%eax
je     11bc <assemble_object_code+0x8c>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
jne    11e3 <assemble_object_code+0xb3>
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
sub    $0x4,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
add    $0x8,%edx
mov    %dl,(%rax,%rcx,1)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble_object_code>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rcx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x2c,-0x2(%rax,%rbx,1)
jne    117c <assemble_object_code+0x4c>
mov    -0x1(%rax,%rbx,1),%al
or     $0x20,%al
cmp    $0x78,%al
jne    117c <assemble_object_code+0x4c>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
addb   $0x8,-0x4(%rax,%r14,1)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @assemble_object_code(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [50 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %8
%12 = load i8*, i8** %6
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %8
%15 = load i8*, i8** %7
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = load i8*, i8** %6
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %9
%19 = load i8*, i8** %6
%20 = load i32, i32* %9
%21 = sub nsw i32 %20, 2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 44
br i1 %26, label %27, label %56
27: ; preds = %4
%28 = load i8*, i8** %6
%29 = load i32, i32* %9
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 88
br i1 %35, label %45, label %36
36: ; preds = %27
%37 = load i8*, i8** %6
%38 = load i32, i32* %9
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 120
br i1 %44, label %45, label %56
45: ; preds = %36, %27
%46 = load i8*, i8** %8
%47 = load i8*, i8** %8
%48 = call i32 @strlen(i8* %47)
%49 = sub nsw i32 %48, 4
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %46, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = add nsw i32 %53, 8
%55 = trunc i32 %54 to i8
store i8 %55, i8* %51
br label %56
56: ; preds = %45, %36, %4
ret void
}

LLVM IR (-O2):
define void @assemble_object_code(i8* nocapture readnone %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @strcpy(i8* %3, i8* %1)
%6 = tail call i32 @strcat(i8* %3, i8* %2)
%7 = tail call i32 @strlen(i8* %1)
%8 = add nsw i32 %7, -2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 44
br i1 %12, label %13, label %25
13: ; preds = %4
%14 = add nsw i32 %7, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %1, i64 %15
%17 = load i8, i8* %16
switch i8 %17, label %25 [
i8 88, label %18
i8 120, label %18
]
18: ; preds = %13, %13
%19 = tail call i32 @strlen(i8* %3)
%20 = add nsw i32 %19, -4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %3, i64 %21
%23 = load i8, i8* %22
%24 = add i8 %23, 8
store i8 %24, i8* %22
br label %25
25: ; preds = %13, %18, %4
ret void
}