#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int sprintf(char *, char *, char *, int, char *);
int /*<<< orphan*/ stderr;
void addClassAndExtension(char *fname, int classNum, char *extension,
                          char *target) {
  if (sprintf(target, "%s_class%i.%s", fname, classNum, extension) >= 1000) {
    fprintf(stderr, "Argument outFile is too long\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<addClassAndExtension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xea3(%rip),%rsi
call   1040 <sprintf@plt>
cmp    $0x3e8,%eax
jl     1190 <addClassAndExtension+0x60>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addClassAndExtension>:
push   %rax
mov    %rdx,%r8
mov    %esi,%eax
mov    %rdi,%rdx
lea    0xec0(%rip),%rsi
mov    %rcx,%rdi
mov    %eax,%ecx
call   1040 <sprintf@plt>
cmp    $0x3e8,%eax
jge    1153 <addClassAndExtension+0x23>
pop    %rax
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%s_class%i.%s\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Argument outFile is too long\0A\00"
@EXIT_FAILURE = global i32 0
define void @addClassAndExtension(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i8* %12)
%14 = icmp sge i32 %13, 1000
br i1 %14, label %15, label %20
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s_class%i.%s\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Argument outFile is too long\0A\00"
@EXIT_FAILURE = global i32 0
define void @addClassAndExtension(i8* %0, i32 %1, i8* %2, i8* nocapture writeonly %3) {
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
%6 = icmp sgt i32 %5, 999
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %4
ret void
}