#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 */
char *eipa_malloc(size_t, int, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *);
int strlen(char *);
char *preprocessor(int architecture) {
  char arch[128];
  snprintf(arch, 128, "%d", architecture);
  char *arch_prefix = "#if __CUDA_ARCH__ >= ";
  char *arch_middle = "\n\t/* TODO: insert code arch >= ";
  char *arch_suffix = " here */\n#endif /* if */\n";
  size_t strSize = strlen(arch_prefix) + strlen(arch_middle) +
                   strlen(arch_suffix) + 2 * strlen(arch) + 1;
  char *arch_final =
      eipa_malloc((strSize), 410,
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/"
                  "heads/master/Cuda-SAK/functions.c");
  sprintf(arch_final, "%s%s%s%s%s", arch_prefix, arch, arch_middle, arch,
          arch_suffix);
  return arch_final;
}


x86 assembly (clang, -O0):
<preprocessor>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x80,%esi
lea    0xe9c(%rip),%rdx
call   1040 <snprintf@plt>
lea    0xe93(%rip),%rax
mov    %rax,-0x98(%rbp)
lea    0xe9b(%rip),%rax
mov    %rax,-0xa0(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x98(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc4(%rbp)
mov    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xc4(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc0(%rbp)
mov    -0xa8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xc0(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xbc(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
add    $0x1,%eax
cltq
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rdi
mov    $0x19a,%esi
lea    0xe3e(%rip),%rdx
call   1050 <eipa_malloc@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rdi
mov    -0x98(%rbp),%rdx
lea    -0x90(%rbp),%rcx
mov    -0xa0(%rbp),%r8
lea    -0x90(%rbp),%r9
mov    -0xa8(%rbp),%rax
lea    0xe96(%rip),%rsi
mov    %rax,(%rsp)
call   1060 <sprintf@plt>
mov    -0xb8(%rbp),%rax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<preprocessor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %edi,%ecx
lea    0xea6(%rip),%rdx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0x80,%esi
call   1040 <snprintf@plt>
lea    0xe90(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xe98(%rip),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
lea    0xea7(%rip),%r13
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%ebx
add    %r14d,%ebx
lea    (%rbx,%rax,2),%eax
add    $0x1,%eax
movslq %eax,%rdi
lea    0xe99(%rip),%rdx
mov    $0x19a,%esi
call   1050 <eipa_malloc@plt>
mov    %rax,%rbx
mov    %r13,(%rsp)
lea    0xf16(%rip),%rsi
mov    %rax,%rdi
lea    0xe27(%rip),%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   1060 <sprintf@plt>
mov    %rbx,%rax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [22 x i8] c"#if __CUDA_ARCH__ >= \00"
@.str.2 = [32 x i8] c"\0A\09/* TODO: insert code arch >= \00"
@.str.3 = [26 x i8] c" here */\0A#endif /* if */\0A\00"
@.str.4 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/Cuda-SAK/functions.c\00"
@.str.5 = [11 x i8] c"%s%s%s%s%s\00"
define i8* @preprocessor(i32 %0) {
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
store i32 %0, i32* %2
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = call i32 @snprintf(i8* %9, i32 128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8** %6
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
%16 = add nsw i32 %13, %15
%17 = load i8*, i8** %6
%18 = call i32 @strlen(i8* %17)
%19 = add nsw i32 %16, %18
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = mul nsw i32 2, %21
%23 = add nsw i32 %19, %22
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
store i64 %25, i64* %7
%26 = load i64, i64* %7
%27 = call i8* @eipa_malloc(i64 %26, i32 410, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.4, i64 0, i64 0))
store i8* %27, i8** %8
%28 = load i8*, i8** %8
%29 = load i8*, i8** %4
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%31 = load i8*, i8** %5
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%33 = load i8*, i8** %6
%34 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %29, i8* %30, i8* %31, i8* %32, i8* %33)
%35 = load i8*, i8** %8
ret i8* %35
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [22 x i8] c"#if __CUDA_ARCH__ >= \00"
@.str.2 = [32 x i8] c"\0A\09/* TODO: insert code arch >= \00"
@.str.3 = [26 x i8] c" here */\0A#endif /* if */\0A\00"
@.str.4 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/Cuda-SAK/functions.c\00"
@.str.5 = [11 x i8] c"%s%s%s%s%s\00"
define i8* @preprocessor(i32 %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i32 @strlen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @strlen(i8* %3)
%9 = shl nsw i32 %8, 1
%10 = add i32 %5, 1
%11 = add i32 %10, %6
%12 = add i32 %11, %7
%13 = add i32 %12, %9
%14 = sext i32 %13 to i64
%15 = call i8* @eipa_malloc(i64 %14, i32 410, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @sprintf(i8* dereferenceable(1) %15, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
ret i8* %15
}