int parse_tca_tcindex_shift(char *msg, char **mp, struct rtattr *tcindex) {
  if (RTA_PAYLOAD(tcindex) < sizeof(int)) {
    rec_log("error: %s: payload too short", __func__);
    return (1);
  }
  *mp = add_log(msg, *mp, "shift=%d ", *(int *)RTA_DATA(tcindex));
  return (0);
}


x86 assembly (clang, -O0):
<parse_tca_tcindex_shift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <RTA_PAYLOAD@plt>
cltq
cmp    $0x4,%rax
jae    118c <parse_tca_tcindex_shift+0x4c>
lea    0xe8e(%rip),%rdi
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1050 <rec_log@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d5 <parse_tca_tcindex_shift+0x95>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1040 <RTA_DATA@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
cltq
mov    (%rax),%ecx
lea    0xe78(%rip),%rdx
mov    $0x0,%al
call   1060 <add_log@plt>
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_tca_tcindex_shift>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebp,%ebp
mov    %rdx,%rdi
xor    %eax,%eax
call   1030 <RTA_PAYLOAD@plt>
cmp    $0x3,%eax
ja     117e <parse_tca_tcindex_shift+0x3e>
lea    0xe97(%rip),%rdi
lea    0xead(%rip),%rsi
xor    %eax,%eax
call   1050 <rec_log@plt>
mov    $0x1,%ebp
jmp    11a8 <parse_tca_tcindex_shift+0x68>
mov    (%r14),%r12
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <RTA_DATA@plt>
cltq
mov    (%rax),%ecx
lea    0xe9f(%rip),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <add_log@plt>
cltq
mov    %rax,(%r14)
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rtattr = type opaque
@.str = [29 x i8] c"error: %s: payload too short\00"
@__func__.parse_tca_tcindex_shift = [24 x i8] c"parse_tca_tcindex_shift\00"
@.str.1 = [10 x i8] c"shift=%d \00"
define i32 @parse_tca_tcindex_shift(i8* %0, i8** %1, %struct.rtattr* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca %struct.rtattr*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store %struct.rtattr* %2, %struct.rtattr** %7
%8 = load %struct.rtattr*, %struct.rtattr** %7
%9 = call i32 (%struct.rtattr*, ...) bitcast (i32 (...)* @RTA_PAYLOAD to i32 (%struct.rtattr*, ...)*)(%struct.rtattr* %8)
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @rec_log to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__func__.parse_tca_tcindex_shift, i64 0, i64 0))
store i32 1, i32* %4
br label %27
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i8**, i8*** %6
%17 = load i8*, i8** %16
%18 = load %struct.rtattr*, %struct.rtattr** %7
%19 = call i32 (%struct.rtattr*, ...) bitcast (i32 (...)* @RTA_DATA to i32 (%struct.rtattr*, ...)*)(%struct.rtattr* %18)
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load i32, i32* %21
%23 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @add_log to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %15, i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = load i8**, i8*** %6
store i8* %25, i8** %26
store i32 0, i32* %4
br label %27
27: ; preds = %14, %12
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
%struct.rtattr = type opaque
@.str = [29 x i8] c"error: %s: payload too short\00"
@__func__.parse_tca_tcindex_shift = [24 x i8] c"parse_tca_tcindex_shift\00"
@.str.1 = [10 x i8] c"shift=%d \00"
define i32 @parse_tca_tcindex_shift(i8* %0, i8** nocapture %1, %struct.rtattr* %2) {
%4 = tail call i32 (%struct.rtattr*, ...) bitcast (i32 (...)* @RTA_PAYLOAD to i32 (%struct.rtattr*, ...)*)(%struct.rtattr* %2)
%5 = icmp ult i32 %4, 4
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @rec_log to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__func__.parse_tca_tcindex_shift, i64 0, i64 0))
br label %17
8: ; preds = %3
%9 = load i8*, i8** %1
%10 = tail call i32 (%struct.rtattr*, ...) bitcast (i32 (...)* @RTA_DATA to i32 (%struct.rtattr*, ...)*)(%struct.rtattr* %2)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @add_log to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %0, i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %1
br label %17
17: ; preds = %8, %6
%18 = phi i32 [ 1, %6 ], [ 0, %8 ]
ret i32 %18
}