#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*/ printf(char *, long);
long syscall(int, int, int);
int main(int argc, char *argv[]) {
  int id_h = 0x682c;
  int id_l = 0x83e55b77;
  long error;
  error = syscall(333, id_h, id_l);
  if (error) {
    printf("syscall error=%d\n", error);
    return 1;
  }
  id_l += 1;
  error = syscall(333, id_h, id_l);
  if (error) {
    printf("syscall error=%d\n", error);
    return 1;
  }
  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)
movl   $0x682c,-0x14(%rbp)
movl   $0x83e55b77,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x14d,%edi
call   1040 <syscall@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117f <main+0x5f>
mov    -0x20(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ca <main+0xaa>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x14d,%edi
call   1040 <syscall@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11c3 <main+0xa3>
mov    -0x20(%rbp),%rsi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ca <main+0xaa>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14d,%edi
mov    $0x682c,%esi
mov    $0x83e55b77,%edx
call   1040 <syscall@plt>
test   %rax,%rax
jne    1153 <main+0x33>
mov    $0x14d,%edi
mov    $0x682c,%esi
mov    $0x83e55b78,%edx
call   1040 <syscall@plt>
test   %rax,%rax
je     1169 <main+0x49>
lea    0xea6(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"syscall error=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 26668, i32* %6
store i32 -2082120841, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i64 @syscall(i32 333, i32 %9, i32 %10)
store i64 %11, i64* %8
%12 = load i64, i64* %8
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i64, i64* %8
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %15)
store i32 1, i32* %3
br label %29
17: ; preds = %2
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = call i64 @syscall(i32 333, i32 %20, i32 %21)
store i64 %22, i64* %8
%23 = load i64, i64* %8
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %17
%26 = load i64, i64* %8
%27 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %26)
store i32 1, i32* %3
br label %29
28: ; preds = %17
store i32 0, i32* %3
br label %29
29: ; preds = %28, %25, %14
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [18 x i8] c"syscall error=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @syscall(i32 333, i32 26668, i32 -2082120841)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @syscall(i32 333, i32 26668, i32 -2082120840)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %2
%9 = phi i64 [ %3, %2 ], [ %6, %5 ]
%10 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ 0, %5 ], [ 1, %8 ]
ret i32 %12
}