struct Buf *buf_strdefine(buf, str, def)
struct Buf *buf;
const char *str;
const char *def;
{
  buf_strappend(buf, "#define ");
  buf_strappend(buf, " ");
  buf_strappend(buf, str);
  buf_strappend(buf, " ");
  buf_strappend(buf, def);
  buf_strappend(buf, "\n");
  return buf;
}


x86 assembly (clang, -O0):
<buf_strdefine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <buf_strappend@plt>
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <buf_strappend@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <buf_strappend@plt>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1030 <buf_strappend@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <buf_strappend@plt>
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1030 <buf_strappend@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buf_strdefine>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xed8(%rip),%rsi
xor    %eax,%eax
call   1030 <buf_strappend@plt>
lea    0xed1(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <buf_strappend@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <buf_strappend@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <buf_strappend@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <buf_strappend@plt>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <buf_strappend@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Buf = type opaque
@.str = [9 x i8] c"#define \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define %struct.Buf* @buf_strdefine(%struct.Buf* %0, i8* %1, i8* %2) {
%4 = alloca %struct.Buf*
%5 = alloca i8*
%6 = alloca i8*
store %struct.Buf* %0, %struct.Buf** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.Buf*, %struct.Buf** %4
%8 = call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.Buf*, %struct.Buf** %4
%10 = call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = load %struct.Buf*, %struct.Buf** %4
%12 = load i8*, i8** %5
%13 = call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %11, i8* %12)
%14 = load %struct.Buf*, %struct.Buf** %4
%15 = call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = load %struct.Buf*, %struct.Buf** %4
%17 = load i8*, i8** %6
%18 = call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %16, i8* %17)
%19 = load %struct.Buf*, %struct.Buf** %4
%20 = call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = load %struct.Buf*, %struct.Buf** %4
ret %struct.Buf* %21
}

LLVM IR (-O2):
%struct.Buf = type opaque
@.str = [9 x i8] c"#define \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define %struct.Buf* @buf_strdefine(%struct.Buf* returned %0, i8* %1, i8* %2) {
%4 = tail call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %0, i8* %1)
%7 = tail call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %0, i8* %2)
%9 = tail call i32 (%struct.Buf*, i8*, ...) bitcast (i32 (...)* @buf_strappend to i32 (%struct.Buf*, i8*, ...)*)(%struct.Buf* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret %struct.Buf* %0
}