#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 */
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
void writeTweet(char *tweet, const int fn, const int ln, const int hits,
                const int month, const int day, char *line) {
  short *ptr1 = (short *)tweet;
  *ptr1 = (short)fn;
  int *ptr2 = (int *)(tweet + 2);
  *ptr2 = ln;
  *(tweet + 6) = (char)hits;
  *(tweet + 7) = (char)month;
  *(tweet + 8) = (char)day;
  int i;
  int n = 32 - 9;
  for (i = strlen(line); i < n; i++)
    line[i] = ' ';
  memcpy(tweet + 9, line, n);
}


x86 assembly (clang, -O0):
<writeTweet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x18(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x8(%rax)
movl   $0x17,-0x38(%rbp)
mov    0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11c8 <writeTweet+0xa8>
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a2 <writeTweet+0x82>
mov    -0x8(%rbp),%rdi
add    $0x9,%rdi
mov    0x10(%rbp),%rsi
mov    -0x38(%rbp),%edx
call   1040 <memcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeTweet>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x20(%rsp),%r14
mov    %si,(%rdi)
mov    %edx,0x2(%rdi)
mov    %cl,0x6(%rdi)
mov    %r8b,0x7(%rdi)
mov    %r9b,0x8(%rdi)
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    $0x16,%eax
jg     1175 <writeTweet+0x45>
movslq %eax,%rdi
add    %r14,%rdi
mov    $0x16,%edx
sub    %eax,%edx
add    $0x1,%rdx
mov    $0x20,%esi
call   1040 <memset@plt>
add    $0x9,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x17,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <memcpy@plt>

LLVM IR (-O0):
define void @writeTweet(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i16*
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i8* %6, i8** %14
%19 = load i8*, i8** %8
%20 = bitcast i8* %19 to i16*
store i16* %20, i16** %15
%21 = load i32, i32* %9
%22 = trunc i32 %21 to i16
%23 = load i16*, i16** %15
store i16 %22, i16* %23
%24 = load i8*, i8** %8
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = bitcast i8* %25 to i32*
store i32* %26, i32** %16
%27 = load i32, i32* %10
%28 = load i32*, i32** %16
store i32 %27, i32* %28
%29 = load i32, i32* %11
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i64 6
store i8 %30, i8* %32
%33 = load i32, i32* %12
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %8
%36 = getelementptr inbounds i8, i8* %35, i64 7
store i8 %34, i8* %36
%37 = load i32, i32* %13
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %8
%40 = getelementptr inbounds i8, i8* %39, i64 8
store i8 %38, i8* %40
store i32 23, i32* %18
%41 = load i8*, i8** %14
%42 = call i32 @strlen(i8* %41)
store i32 %42, i32* %17
br label %43
43: ; preds = %52, %7
%44 = load i32, i32* %17
%45 = load i32, i32* %18
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %55
47: ; preds = %43
%48 = load i8*, i8** %14
%49 = load i32, i32* %17
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8 32, i8* %51
br label %52
52: ; preds = %47
%53 = load i32, i32* %17
%54 = add nsw i32 %53, 1
store i32 %54, i32* %17
br label %43
55: ; preds = %43
%56 = load i8*, i8** %8
%57 = getelementptr inbounds i8, i8* %56, i64 9
%58 = load i8*, i8** %14
%59 = load i32, i32* %18
%60 = call i32 @memcpy(i8* %57, i8* %58, i32 %59)
ret void
}

LLVM IR (-O2):
define void @writeTweet(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6) {
%8 = bitcast i8* %0 to i16*
%9 = trunc i32 %1 to i16
store i16 %9, i16* %8
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = bitcast i8* %10 to i32*
store i32 %2, i32* %11
%12 = trunc i32 %3 to i8
%13 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %12, i8* %13
%14 = trunc i32 %4 to i8
%15 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %14, i8* %15
%16 = trunc i32 %5 to i8
%17 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %16, i8* %17
%18 = tail call i32 @strlen(i8* %6)
%19 = icmp slt i32 %18, 23
br i1 %19, label %20, label %26
20: ; preds = %7
%21 = sext i32 %18 to i64
%22 = getelementptr i8, i8* %6, i64 %21
%23 = sub i32 22, %18
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
br label %26
26: ; preds = %20, %7
%27 = getelementptr inbounds i8, i8* %0, i64 9
%28 = tail call i32 @memcpy(i8* %27, i8* %6, i32 23)
ret void
}