#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 *, ...);
int write_line(FILE *intr_file, const char *label, const char *opcode,
               const char *operand, int loc) {
  int bytes = 0;
  bytes += fprintf(intr_file, "%X\t", loc);
  bytes += fprintf(intr_file, "%s\t", label);
  bytes += fprintf(intr_file, "%s\t", opcode);
  bytes += fprintf(intr_file, "%s\n", operand);
  return bytes;
}


x86 assembly (clang, -O0):
<write_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r15
lea    0xed1(%rip),%rsi
mov    %r8d,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rax,%r13
lea    0xec1(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rax,%rbp
add    %r13d,%ebp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0xe93(%rip),%rsi
mov    %r15,%rdi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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