#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, char *);
int write_line(FILE *f, char *loc, char *label, char *opcode, char *operand,
               char *obj_code) {
  int bytes = 0;
  bytes += fprintf(f, "%s\t", loc);
  bytes += fprintf(f, "%s\t", label);
  bytes += fprintf(f, "%s\t", opcode);
  bytes += fprintf(f, "%s\t", operand);
  bytes += fprintf(f, "%s\n", obj_code);
  return bytes;
}


x86 assembly (clang, -O0):
<write_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe99(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe78(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe57(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe3a(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,%rbx
mov    %rdx,%r13
mov    %rsi,%rdx
mov    %rdi,%r12
lea    0xec5(%rip),%r15
mov    %r15,%rsi
call   1030 <fprintf@plt>
mov    %rax,%r14
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <fprintf@plt>
mov    %rax,%rbp
add    %r14d,%ebp
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    %rax,%rbx
add    %ebp,%ebx
mov    %r12,%rdi
mov    %r15,%rsi
mov    0x8(%rsp),%rdx
call   1030 <fprintf@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0xe7b(%rip),%rsi
mov    %r12,%rdi
mov    0x10(%rsp),%rdx
call   1030 <fprintf@plt>
add    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\09\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @write_line(i32* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
store i32* %0, i32** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
store i32 0, i32* %13
%14 = load i32*, i32** %7
%15 = load i8*, i8** %8
%16 = call i64 @fprintf(i32* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %13
%18 = sext i32 %17 to i64
%19 = add nsw i64 %18, %16
%20 = trunc i64 %19 to i32
store i32 %20, i32* %13
%21 = load i32*, i32** %7
%22 = load i8*, i8** %9
%23 = call i64 @fprintf(i32* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = add nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %13
%28 = load i32*, i32** %7
%29 = load i8*, i8** %10
%30 = call i64 @fprintf(i32* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %13
%32 = sext i32 %31 to i64
%33 = add nsw i64 %32, %30
%34 = trunc i64 %33 to i32
store i32 %34, i32* %13
%35 = load i32*, i32** %7
%36 = load i8*, i8** %11
%37 = call i64 @fprintf(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = load i32, i32* %13
%39 = sext i32 %38 to i64
%40 = add nsw i64 %39, %37
%41 = trunc i64 %40 to i32
store i32 %41, i32* %13
%42 = load i32*, i32** %7
%43 = load i8*, i8** %12
%44 = call i64 @fprintf(i32* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %43)
%45 = load i32, i32* %13
%46 = sext i32 %45 to i64
%47 = add nsw i64 %46, %44
%48 = trunc i64 %47 to i32
store i32 %48, i32* %13
%49 = load i32, i32* %13
ret i32 %49
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\09\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @write_line(i32* nocapture %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = add i64 %8, %7
%10 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = add i64 %9, %10
%12 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = add i64 %11, %12
%14 = tail call i64 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%15 = add i64 %13, %14
%16 = trunc i64 %15 to i32
ret i32 %16
}