#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 *drmaa_gw_strstatus(int);
int drmaa_job_ps(char *, int *, char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void print_job_status(char *id) {
  int rc;
  char error[1024];
  int status;
  rc = drmaa_job_ps(id, &status, error, 1024 - 1);
  if (rc != 0) {
    fprintf(stderr, "drmaa_job_ps() failed: %s\n", error);
    exit(-1);
  }
  fprintf(stdout, "Job state is: %s\n", drmaa_gw_strstatus(status));
}


x86 assembly (clang, -O0):
<print_job_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    -0x414(%rbp),%rsi
mov    $0x3ff,%ecx
call   1030 <drmaa_job_ps@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     119e <print_job_status+0x5e>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rdx
lea    0xe71(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x418(%rbp)
mov    -0x414(%rbp),%edi
call   1040 <drmaa_gw_strstatus@plt>
mov    -0x418(%rbp),%edi
mov    %rax,%rdx
lea    0xe53(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_job_status>:
push   %rbx
sub    $0x410,%rsp
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    $0x3ff,%ecx
call   1030 <drmaa_job_ps@plt>
test   %eax,%eax
jne    118c <print_job_status+0x4c>
mov    0x2e71(%rip),%rax
mov    (%rax),%ebx
mov    0xc(%rsp),%edi
call   1040 <drmaa_gw_strstatus@plt>
lea    0xea2(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
add    $0x410,%rsp
pop    %rbx
ret
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"drmaa_job_ps() failed: %s\0A\00"
@stdout = global i32 0
@.str.1 = [18 x i8] c"Job state is: %s\0A\00"
define void @print_job_status(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = call i32 @drmaa_job_ps(i8* %6, i32* %5, i8* %7, i32 1023)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %1
%17 = load i32, i32* @stdout
%18 = load i32, i32* %5
%19 = call i8* @drmaa_gw_strstatus(i32 %18)
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %19)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"drmaa_job_ps() failed: %s\0A\00"
@stdout = global i32 0
@.str.1 = [18 x i8] c"Job state is: %s\0A\00"
define void @print_job_status(i8* %0) {
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
%6 = call i32 @drmaa_job_ps(i8* %0, i32* %3, i8* %4, i32 1023)
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4)
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %1
%13 = load i32, i32* @stdout
%14 = load i32, i32* %3
%15 = call i8* @drmaa_gw_strstatus(i32 %14)
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %15)
ret void
}