#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, char *, int);
int main(int argc, char **argv) {
  char buf[8];
  if (read(0, buf, 8) < 1) {
    printf("Hum?\n");
    exit(1);
  }
  if (buf[0] == '0')
    printf("Looks like a zero to me!\n");
  else
    printf("A non-zero value? How quaint!\n");
  exit(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)
lea    -0x18(%rbp),%rsi
xor    %edi,%edi
mov    $0x8,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
jge    1175 <main+0x45>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movsbl -0x18(%rbp),%eax
cmp    $0x30,%eax
jne    1193 <main+0x63>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
jmp    119f <main+0x6f>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0x8,%edx
call   1040 <read@plt>
test   %eax,%eax
jg     115a <main+0x2a>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpb   $0x30,(%rsp)
lea    0xeb9(%rip),%rax
lea    0xe94(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Hum?\0A\00"
@.str.1 = [26 x i8] c"Looks like a zero to me!\0A\00"
@.str.2 = [31 x i8] c"A non-zero value? How quaint!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%8 = call i32 @read(i32 0, i8* %7, i32 8)
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 48
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %13
%21 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
%23 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [30 x i8] c"A non-zero value? How quaint!\00"
@str.3 = [25 x i8] c"Looks like a zero to me!\00"
@str.4 = [5 x i8] c"Hum?\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 8)
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = load i8, i8* %4
%12 = icmp eq i8 %11, 48
%13 = select i1 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0)
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
%15 = tail call i32 @exit(i32 0)
unreachable
}