#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
int strlen(char const *);
unsigned long push_rest(const char *name, unsigned long offset, FILE *output) {
  size_t name_len = strlen(name) + 1;
  size_t tmp_ofs;
  fputs(name, output);
  fputc(0, output);
  offset += name_len;
  tmp_ofs = name_len + 110;
  while (tmp_ofs & 3) {
    fputc(0, output);
    offset++;
    tmp_ofs++;
  }
  return offset;
}


x86 assembly (clang, -O0):
<push_rest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1050 <fputc@plt>
mov    -0x20(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x6e,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
and    $0x3,%rax
cmp    $0x0,%rax
je     11c0 <push_rest+0x90>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1050 <fputc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1186 <push_rest+0x56>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_rest>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
movslq %eax,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <fputs@plt>
xor    %edi,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    -0x1(%rbx),%eax
test   $0x3,%al
je     118a <push_rest+0x5a>
add    $0x1,%rbx
nopl   0x0(%rax)
xor    %edi,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    -0x1(%rbx),%eax
add    $0x1,%rbx
test   $0x3,%al
jne    1170 <push_rest+0x40>
add    %rbx,%r14
jmp    1191 <push_rest+0x61>
add    %rbx,%r14
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @push_rest(i8* %0, i64 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
store i64 %12, i64* %7
%13 = load i8*, i8** %4
%14 = load i32*, i32** %6
%15 = call i32 @fputs(i8* %13, i32* %14)
%16 = load i32*, i32** %6
%17 = call i32 @fputc(i32 0, i32* %16)
%18 = load i64, i64* %7
%19 = load i64, i64* %5
%20 = add i64 %19, %18
store i64 %20, i64* %5
%21 = load i64, i64* %7
%22 = add i64 %21, 110
store i64 %22, i64* %8
br label %23
23: ; preds = %27, %3
%24 = load i64, i64* %8
%25 = and i64 %24, 3
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i32*, i32** %6
%29 = call i32 @fputc(i32 0, i32* %28)
%30 = load i64, i64* %5
%31 = add i64 %30, 1
store i64 %31, i64* %5
%32 = load i64, i64* %8
%33 = add i64 %32, 1
store i64 %33, i64* %8
br label %23
34: ; preds = %23
%35 = load i64, i64* %5
ret i64 %35
}

LLVM IR (-O2):
define i64 @push_rest(i8* %0, i64 %1, i32* nocapture %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i32 @fputs(i8* %0, i32* %2)
%8 = tail call i32 @fputc(i32 0, i32* %2)
%9 = add i64 %6, %1
%10 = add nsw i64 %6, 110
%11 = and i64 %10, 3
%12 = icmp eq i64 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %3, %13
%14 = phi i64 [ %18, %13 ], [ %10, %3 ]
%15 = phi i64 [ %17, %13 ], [ %9, %3 ]
%16 = tail call i32 @fputc(i32 0, i32* %2)
%17 = add i64 %15, 1
%18 = add nsw i64 %14, 1
%19 = and i64 %18, 3
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %13
21: ; preds = %13, %3
%22 = phi i64 [ %9, %3 ], [ %17, %13 ]
ret i64 %22
}