#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 */
char *append(char *, char *);
int asmNewLine(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
scalar_t__ fwrite(char *, int, scalar_t__, int /*<<< orphan*/ *);
scalar_t__ strlen(char *);
int asmLabel(FILE *file, char *string) {
  int i = 0;
  char *buffer = append(string, ":");
  if (fwrite(buffer, sizeof(char), strlen(buffer), file) != strlen(buffer))
    goto out;
  i = asmNewLine(file);
out:
  free(buffer);
  return i;
}


x86 assembly (clang, -O0):
<asmLabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1040 <append@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1070 <fwrite@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     11c3 <asmLabel+0x73>
jmp    11cf <asmLabel+0x7f>
mov    -0x8(%rbp),%rdi
call   1050 <asmNewLine@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asmLabel>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xe9c(%rip),%rsi
mov    %rax,%rdi
call   1040 <append@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <strlen@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r14,%rcx
call   1070 <fwrite@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
xor    %ebp,%ebp
cmp    %rax,%r15
jne    11a6 <asmLabel+0x56>
mov    %r14,%rdi
call   1050 <asmNewLine@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define i32 @asmLabel(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%7 = load i8*, i8** %4
%8 = call i8* @append(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = call i64 @strlen(i8* %10)
%12 = load i32*, i32** %3
%13 = call i64 @fwrite(i8* %9, i32 1, i64 %11, i32* %12)
%14 = load i8*, i8** %6
%15 = call i64 @strlen(i8* %14)
%16 = icmp ne i64 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
br label %21
18: ; preds = %2
%19 = load i32*, i32** %3
%20 = call i32 @asmNewLine(i32* %19)
store i32 %20, i32* %5
br label %21
21: ; preds = %18, %17
%22 = load i8*, i8** %6
%23 = call i32 @free(i8* %22)
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define i32 @asmLabel(i32* %0, i8* %1) {
%3 = tail call i8* @append(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%5 = tail call i64 @fwrite(i8* %3, i32 1, i64 %4, i32* %0)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @asmNewLine(i32* %0)
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ 0, %2 ], [ %9, %8 ]
%12 = tail call i32 @free(i8* %3)
ret i32 %11
}