#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 GPTLerror(char *, char const *, ...);
scalar_t__ GPTLpr_file(char *);
int /*<<< orphan*/ sprintf(char *, char *, int const);
int GPTLpr(const int id) {
  char outfile[14];
  static const char *thisfunc = "GPTLpr";
  if (id < 0 || id > 999999)
    return GPTLerror(
        "%s: bad id=%d for output file. Must be >= 0 and < 1000000\n", thisfunc,
        id);
  sprintf(outfile, "timing.%d", id);
  if (GPTLpr_file(outfile) != 0)
    return GPTLerror("%s: Error in GPTLpr_file\n", thisfunc);
  return 0;
}


x86 assembly (clang, -O0):
<GPTLpr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1152 <GPTLpr+0x22>
cmpl   $0xf423f,-0x8(%rbp)
jle    1172 <GPTLpr+0x42>
mov    0x2edf(%rip),%rsi
mov    -0x8(%rbp),%edx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <GPTLerror@plt>
mov    %eax,-0x4(%rbp)
jmp    11bc <GPTLpr+0x8c>
lea    -0x16(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xec2(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x16(%rbp),%rdi
call   1050 <GPTLpr_file@plt>
cmp    $0x0,%rax
je     11b5 <GPTLpr+0x85>
mov    0x2e99(%rip),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <GPTLerror@plt>
mov    %eax,-0x4(%rbp)
jmp    11bc <GPTLpr+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPTLpr>:
mov    %edi,%edx
cmp    $0xf4240,%edi
jb     114f <GPTLpr+0x1f>
lea    0xec6(%rip),%rdi
lea    0xeb8(%rip),%rsi
xor    %eax,%eax
jmp    1030 <GPTLerror@plt>
push   %rbx
sub    $0x10,%rsp
lea    0xee7(%rip),%rsi
lea    0x2(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <GPTLpr_file@plt>
test   %rax,%rax
je     118c <GPTLpr+0x5c>
lea    0xed0(%rip),%rdi
lea    0xe7d(%rip),%rsi
xor    %eax,%eax
call   1030 <GPTLerror@plt>
jmp    118e <GPTLpr+0x5e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@GPTLpr.thisfunc = internal global i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0)
@.str = [7 x i8] c"GPTLpr\00"
@.str.1 = [59 x i8] c"%s: bad id=%d for output file. Must be >= 0 and < 1000000\0A\00"
@.str.2 = [10 x i8] c"timing.%d\00"
@.str.3 = [26 x i8] c"%s: Error in GPTLpr_file\0A\00"
define i32 @GPTLpr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [14 x i8]
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 999999
br i1 %9, label %10, label %14
10: ; preds = %7, %1
%11 = load i8*, i8** @GPTLpr.thisfunc
%12 = load i32, i32* %3
%13 = call i32 (i8*, i8*, ...) @GPTLerror(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %12)
store i32 %13, i32* %2
br label %25
14: ; preds = %7
%15 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%16 = load i32, i32* %3
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%19 = call i64 @GPTLpr_file(i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = load i8*, i8** @GPTLpr.thisfunc
%23 = call i32 (i8*, i8*, ...) @GPTLerror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %22)
store i32 %23, i32* %2
br label %25
24: ; preds = %14
store i32 0, i32* %2
br label %25
25: ; preds = %24, %21, %10
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [7 x i8] c"GPTLpr\00"
@.str.1 = [59 x i8] c"%s: bad id=%d for output file. Must be >= 0 and < 1000000\0A\00"
@.str.2 = [10 x i8] c"timing.%d\00"
@.str.3 = [26 x i8] c"%s: Error in GPTLpr_file\0A\00"
define i32 @GPTLpr(i32 %0) {
%2 = alloca [14 x i8]
%3 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%4 = icmp ugt i32 %0, 999999
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, i8*, ...) @GPTLerror(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %13
7: ; preds = %1
%8 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%9 = call i64 @GPTLpr_file(i8* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 (i8*, i8*, ...) @GPTLerror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %7, %11, %5
%14 = phi i32 [ %6, %5 ], [ %12, %11 ], [ 0, %7 ]
ret i32 %14
}