#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 *, char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcat(char *, char *);
void mountDrive(char *mnt, char *name) {
  char buf[1024];
  memset(buf, '\0', 1024);
  strcat(buf, "[");
  strcat(buf, mnt);
  strcat(buf, "]");
  strcat(buf, "\nVendor : VirtualDrive\nProduct : ");
  strcat(buf, name);
  strcat(buf,
         "\nSerial : Q80VQFLF\nDevpath : 4\nLun : 0\nMountDir : /dtv/usb/");
  strcat(buf, mnt);
  strcat(buf, "\nFileSystem : vfat\n\n");
  FILE *log = fopen("/dtv/usb/log", "a");
  fprintf(log, "%s", buf);
  fprintf(stdout, "%s", buf);
  fclose(log);
}


x86 assembly (clang, -O0):
<mountDrive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x410(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1070 <strcat@plt>
lea    0xe6b(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xe52(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%rdi
lea    -0x410(%rbp),%rdx
lea    0xe35(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x418(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mountDrive>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    0xe83(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe6b(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
lea    0xe5e(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
lea    0xe66(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe88(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
lea    0xe8e(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%rsi
mov    %r12,%rdi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"[\00"
@.str.1 = [2 x i8] c"]\00"
@.str.2 = [34 x i8] c"\0AVendor : VirtualDrive\0AProduct : \00"
@.str.3 = [60 x i8] c"\0ASerial : Q80VQFLF\0ADevpath : 4\0ALun : 0\0AMountDir : /dtv/usb/\00"
@.str.4 = [21 x i8] c"\0AFileSystem : vfat\0A\0A\00"
@.str.5 = [13 x i8] c"/dtv/usb/log\00"
@.str.6 = [2 x i8] c"a\00"
@.str.7 = [3 x i8] c"%s\00"
@stdout = global i32* null
define void @mountDrive(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i8 signext 0, i32 1024)
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = load i8*, i8** %3
%13 = call i32 @strcat(i8* %11, i8* %12)
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%17 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%19 = load i8*, i8** %4
%20 = call i32 @strcat(i8* %18, i8* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%22 = call i32 @strcat(i8* %21, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%24 = load i8*, i8** %3
%25 = call i32 @strcat(i8* %23, i8* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %28, i32** %6
%29 = load i32*, i32** %6
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%31 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %30)
%32 = load i32*, i32** @stdout
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%34 = call i32 @fprintf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %33)
%35 = load i32*, i32** %6
%36 = call i32 @fclose(i32* %35)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"[\00"
@.str.1 = [2 x i8] c"]\00"
@.str.2 = [34 x i8] c"\0AVendor : VirtualDrive\0AProduct : \00"
@.str.3 = [60 x i8] c"\0ASerial : Q80VQFLF\0ADevpath : 4\0ALun : 0\0AMountDir : /dtv/usb/\00"
@.str.4 = [21 x i8] c"\0AFileSystem : vfat\0A\0A\00"
@.str.5 = [13 x i8] c"/dtv/usb/log\00"
@.str.6 = [2 x i8] c"a\00"
@stdout = global i32* null
define void @mountDrive(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 0, i32 1024)
%6 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @strcat(i8* %4, i8* %0)
%8 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @strcat(i8* %4, i8* %1)
%11 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @strcat(i8* %4, i8* %0)
%13 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @fputs(i8* %4, i32* %14)
%16 = load i32*, i32** @stdout
%17 = call i32 @fputs(i8* %4, i32* %16)
%18 = call i32 @fclose(i32* %14)
ret void
}