#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 */

/* Variables and functions */
char *malloc(size_t);
int send_bytes(int, char *, size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int send_log_in(int fd, const char *name) {
  size_t len = strlen(name) + 2;
  char *msg = malloc((len + 1) * sizeof(char));
  strcpy(msg, "2.");
  strcpy(msg + 2, name);
  return send_bytes(fd, msg, len);
}


x86 assembly (clang, -O0):
<send_log_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x2,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <send_bytes@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_log_in>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
lea    0x2(%rdi),%r15
add    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbp
lea    0xe91(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
lea    0x2(%rbp),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <send_bytes@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"2.\00"
define i32 @send_log_in(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = add nsw i32 %8, 2
%10 = sext i32 %9 to i64
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = add i64 %11, 1
%13 = mul i64 %12, 1
%14 = call i8* @malloc(i64 %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8*, i8** %4
%20 = call i32 @strcpy(i8* %18, i8* %19)
%21 = load i32, i32* %3
%22 = load i8*, i8** %6
%23 = load i64, i64* %5
%24 = call i32 @send_bytes(i32 %21, i8* %22, i64 %23)
ret i32 %24
}

LLVM IR (-O2):
@.str = [3 x i8] c"2.\00"
define i32 @send_log_in(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = add nsw i32 %3, 2
%5 = sext i32 %4 to i64
%6 = add nsw i64 %5, 1
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds i8, i8* %7, i64 2
%10 = tail call i32 @strcpy(i8* %9, i8* %1)
%11 = tail call i32 @send_bytes(i32 %0, i8* %7, i64 %5)
ret i32 %11
}