void action_define(defname, value) char *defname;
int value;
{
  char buf[2048];
  if ((int)strlen(defname) > 2048 / 2) {
    format_pinpoint_message(("name \"%s\" ridiculously long"), defname);
    return;
  }
  sprintf(buf, "#define %s %d\n", defname, value);
  add_action(buf);
}


x86 assembly (clang, -O0):
<action_define>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x400,%eax
jle    117d <action_define+0x3d>
mov    -0x8(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <format_pinpoint_message@plt>
jmp    11a7 <action_define+0x67>
lea    -0x810(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x810(%rbp),%rdi
mov    $0x0,%al
call   1060 <add_action@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<action_define>:
push   %rbp
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x401,%eax
jl     1178 <action_define+0x38>
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <format_pinpoint_message@plt>
lea    0xe9d(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <add_action@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"name \22%s\22 ridiculously long\00"
@.str.1 = [15 x i8] c"#define %s %d\0A\00"
define void @action_define(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [2048 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
%9 = icmp sgt i32 %8, 1024
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @format_pinpoint_message to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %20
13: ; preds = %2
%14 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %16)
%18 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @add_action to i32 (i8*, ...)*)(i8* %18)
br label %20
20: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"name \22%s\22 ridiculously long\00"
@.str.1 = [15 x i8] c"#define %s %d\0A\00"
define void @action_define(i8* %0, i32 %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = trunc i64 %5 to i32
%7 = icmp sgt i32 %6, 1024
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @format_pinpoint_message to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %13
10: ; preds = %2
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1)
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @add_action to i32 (i8*, ...)*)(i8* %4)
br label %13
13: ; preds = %10, %8
ret void
}