#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void Name_PAC(char *filename, char *basename, int y_screens, int x, int y) {
  char ext[9];
  int nr;
  nr = x * (y_screens + 1) + y;
  sprintf(ext, "%02d.pac", nr);
  strcpy(filename, basename);
  strcat(filename, ext);
}


x86 assembly (clang, -O0):
<Name_PAC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x25(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xe96(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x25(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Name_PAC>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%edx
imul   %ecx,%edx
add    %r8d,%edx
lea    0xeb1(%rip),%rsi
lea    0x7(%rsp),%r15
mov    %r15,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%02d.pac\00"
define void @Name_PAC(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [9 x i8]
%12 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %9
%14 = load i32, i32* %8
%15 = add nsw i32 %14, 1
%16 = mul nsw i32 %13, %15
%17 = load i32, i32* %10
%18 = add nsw i32 %16, %17
store i32 %18, i32* %12
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %11, i64 0, i64 0
%20 = load i32, i32* %12
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i8*, i8** %6
%23 = load i8*, i8** %7
%24 = call i32 @strcpy(i8* %22, i8* %23)
%25 = load i8*, i8** %6
%26 = getelementptr inbounds [9 x i8], [9 x i8]* %11, i64 0, i64 0
%27 = call i32 @strcat(i8* %25, i8* %26)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%02d.pac\00"
define void @Name_PAC(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [9 x i8]
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%8 = add nsw i32 %2, 1
%9 = mul nsw i32 %8, %3
%10 = add nsw i32 %9, %4
%11 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 @strcpy(i8* %0, i8* %1)
%13 = call i32 @strcat(i8* %0, i8* %7)
ret void
}