#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void clearLog(char *logname) {
  char filename[256];
  strcpy(filename, logname);
  strcat(filename, ".log");
  FILE *file;
  file = fopen(filename, "w");
  fprintf(file, "%-25s | %-7s | %-6s | %-25s | %-18s \n", "quando", "quem",
          "balcao", "o_que", "canal_criado/usado");
  int i;
  for (i = 0; i < 93; i++)
    fprintf(file, "-");
  fprintf(file, "\n");
  fclose(file);
}


x86 assembly (clang, -O0):
<clearLog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x110(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x110(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rdi
lea    0xe5d(%rip),%rsi
lea    0xe7c(%rip),%rdx
lea    0xe7c(%rip),%rcx
lea    0xe7a(%rip),%r8
lea    0xe7a(%rip),%r9
lea    0xe79(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x11c(%rbp)
cmpl   $0x5d,-0x11c(%rbp)
jge    1218 <clearLog+0xc8>
mov    -0x118(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    11e2 <clearLog+0x92>
mov    -0x118(%rbp),%rdi
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x118(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearLog>:
push   %rbp
push   %rbx
sub    $0x118,%rsp
mov    %rdi,%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xea5(%rip),%rax
mov    %rax,(%rsp)
lea    0xe5b(%rip),%rsi
lea    0xe7a(%rip),%rdx
lea    0xe7a(%rip),%rcx
lea    0xe78(%rip),%r8
lea    0xe78(%rip),%r9
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x5d,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x2d,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0xffffffff,%ebp
jne    11e0 <clearLog+0x80>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x118,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".log\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [38 x i8] c"%-25s | %-7s | %-6s | %-25s | %-18s \0A\00"
@.str.3 = [7 x i8] c"quando\00"
@.str.4 = [5 x i8] c"quem\00"
@.str.5 = [7 x i8] c"balcao\00"
@.str.6 = [6 x i8] c"o_que\00"
@.str.7 = [19 x i8] c"canal_criado/usado\00"
@.str.8 = [2 x i8] c"-\00"
@.str.9 = [2 x i8] c"\0A\00"
define void @clearLog(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %2
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %4
%13 = load i32*, i32** %4
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %5
br label %15
15: ; preds = %21, %1
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 93
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32*, i32** %4
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %21
21: ; preds = %18
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %15
24: ; preds = %15
%25 = load i32*, i32** %4
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%27 = load i32*, i32** %4
%28 = call i32 @fclose(i32* %27)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".log\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [38 x i8] c"%-25s | %-7s | %-6s | %-25s | %-18s \0A\00"
@.str.3 = [7 x i8] c"quando\00"
@.str.4 = [5 x i8] c"quem\00"
@.str.5 = [7 x i8] c"balcao\00"
@.str.6 = [6 x i8] c"o_que\00"
@.str.7 = [19 x i8] c"canal_criado/usado\00"
define void @clearLog(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %8
8: ; preds = %1, %8
%9 = phi i32 [ 0, %1 ], [ %11, %8 ]
%10 = call i32 @fputc(i32 45, i32* %6)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, 93
br i1 %12, label %13, label %8
13: ; preds = %8
%14 = call i32 @fputc(i32 10, i32* %6)
%15 = call i32 @fclose(i32* %6)
ret void
}