int asm_issyslinux(void) {
  unsigned long eax, ebx, ecx, edx;
  eax = 0x00003000;
  ebx = ecx = edx = 0xFFFFFFFF;
  asm("int $0x21" : "+a"(eax), "+b"(ebx), "+c"(ecx), "+d"(edx));
  return (eax == 0x59530000) && (ebx == 0x4c530000) && (ecx == 0x4e490000) &&
         (edx == 0x58550000);
}


x86 assembly (clang, -O0):
<asm_issyslinux>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movq   $0x3000,-0x10(%rbp)
mov    $0xffffffff,%eax
mov    %rax,-0x28(%rbp)
mov    $0xffffffff,%eax
mov    %rax,-0x20(%rbp)
mov    $0xffffffff,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rbx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rdx
int    $0x21
mov    %rax,-0x10(%rbp)
mov    %rbx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x59530000,-0x10(%rbp)
59
mov    %al,-0x29(%rbp)
jne    1191 <asm_issyslinux+0x91>
xor    %eax,%eax
cmpq   $0x4c530000,-0x18(%rbp)
4c
mov    %al,-0x29(%rbp)
jne    1191 <asm_issyslinux+0x91>
xor    %eax,%eax
cmpq   $0x4e490000,-0x20(%rbp)
4e
mov    %al,-0x29(%rbp)
jne    1191 <asm_issyslinux+0x91>
cmpq   $0x58550000,-0x28(%rbp)
58
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_issyslinux>:
push   %rbx
mov    $0x3000,%eax
mov    $0xffffffff,%ebx
mov    $0xffffffff,%ecx
mov    $0xffffffff,%edx
int    $0x21
xor    $0x59530000,%rax
xor    $0x4c530000,%rbx
or     %rax,%rbx
xor    $0x4e490000,%rcx
or     %rbx,%rcx
xor    $0x58550000,%rdx
xor    %eax,%eax
or     %rcx,%rdx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @asm_issyslinux() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 12288, i64* %1
store i64 4294967295, i64* %4
store i64 4294967295, i64* %3
store i64 4294967295, i64* %2
%5 = load i64, i64* %1
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call { i64, i64, i64, i64 } asm "int $$0x21", "={ax},={bx},={cx},={dx},0,1,2,3,~{dirflag},~{fpsr},~{flags}"(i64 %5, i64 %6, i64 %7, i64 %8)
%10 = extractvalue { i64, i64, i64, i64 } %9, 0
%11 = extractvalue { i64, i64, i64, i64 } %9, 1
%12 = extractvalue { i64, i64, i64, i64 } %9, 2
%13 = extractvalue { i64, i64, i64, i64 } %9, 3
store i64 %10, i64* %1
store i64 %11, i64* %2
store i64 %12, i64* %3
store i64 %13, i64* %4
%14 = load i64, i64* %1
%15 = icmp eq i64 %14, 1498611712
br i1 %15, label %16, label %25
16: ; preds = %0
%17 = load i64, i64* %2
%18 = icmp eq i64 %17, 1280507904
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i64, i64* %3
%21 = icmp eq i64 %20, 1313406976
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i64, i64* %4
%24 = icmp eq i64 %23, 1481965568
br label %25
25: ; preds = %22, %19, %16, %0
%26 = phi i1 [ false, %19 ], [ false, %16 ], [ false, %0 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @asm_issyslinux() {
%1 = tail call { i64, i64, i64, i64 } asm "int $$0x21", "={ax},={bx},={cx},={dx},0,1,2,3,~{dirflag},~{fpsr},~{flags}"(i64 12288, i64 4294967295, i64 4294967295, i64 4294967295)
%2 = extractvalue { i64, i64, i64, i64 } %1, 0
%3 = extractvalue { i64, i64, i64, i64 } %1, 1
%4 = extractvalue { i64, i64, i64, i64 } %1, 2
%5 = icmp eq i64 %2, 1498611712
%6 = icmp eq i64 %3, 1280507904
%7 = select i1 %5, i1 %6, i1 false
%8 = icmp eq i64 %4, 1313406976
%9 = select i1 %7, i1 %8, i1 false
%10 = extractvalue { i64, i64, i64, i64 } %1, 3
%11 = icmp eq i64 %10, 1481965568
%12 = select i1 %9, i1 %11, i1 false
%13 = zext i1 %12 to i32
ret i32 %13
}