#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*/ __NR_putpmsg;
int errno;
int /*<<< orphan*/ printf(char *, int);
long syscall(int /*<<< orphan*/);
int main(int argc, char **argv) {
  long int rc = -99;
  rc = syscall(__NR_putpmsg);
  if (rc >= 0)
    printf("Return is: %li\n", rc);
  else
    printf("errno: %d\n", -errno);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xffffffffffffff9d,-0x18(%rbp)
ff
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <syscall@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jl     1172 <main+0x52>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    1189 <main+0x69>
xor    %esi,%esi
mov    0x2e5d(%rip),%rax
sub    (%rax),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1040 <syscall@plt>
test   %rax,%rax
js     113f <main+0x1f>
lea    0xec5(%rip),%rdi
mov    %eax,%esi
jmp    1151 <main+0x31>
mov    0x2e92(%rip),%rax
xor    %esi,%esi
sub    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__NR_putpmsg = global i32 0
@.str = [16 x i8] c"Return is: %li\0A\00"
@.str.1 = [11 x i8] c"errno: %d\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 -99, i64* %6
%7 = load i32, i32* @__NR_putpmsg
%8 = call i64 @syscall(i32 %7)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = icmp sge i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i64, i64* %6
%13 = trunc i64 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %19
15: ; preds = %2
%16 = load i32, i32* @errno
%17 = sub nsw i32 0, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %15, %11
ret i32 0
}

LLVM IR (-O2):
@__NR_putpmsg = global i32 0
@.str = [16 x i8] c"Return is: %li\0A\00"
@.str.1 = [11 x i8] c"errno: %d\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @__NR_putpmsg
%4 = tail call i64 @syscall(i32 %3)
%5 = icmp sgt i64 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = trunc i64 %4 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %13
9: ; preds = %2
%10 = load i32, i32* @errno
%11 = sub nsw i32 0, %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %6
ret i32 0
}