#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 *i();
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ sprint_nybble(int, char *);
scalar_t__ strcmp(char const *, char *);
int main(void) {
  int result = 0;
  const char *s = i();
  if (strcmp(s, "string constant") != 0)
    result = 1;
  char buf[4];
  sprint_nybble(9, buf);
  if (memcmp(buf, "1001", 4) != 0)
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1060 <i@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1182 <main+0x42>
movl   $0x1,-0x8(%rbp)
lea    -0x14(%rbp),%rsi
mov    $0x9,%edi
call   1030 <sprint_nybble@plt>
lea    -0x14(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x4,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     11b6 <main+0x76>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <i@plt>
lea    0xeae(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
mov    %rax,%rbx
lea    0x4(%rsp),%r14
mov    $0x9,%edi
mov    %r14,%rsi
call   1030 <sprint_nybble@plt>
lea    0xe9a(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1040 <memcmp@plt>
xor    %ecx,%ecx
or     %rbx,%rax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"string constant\00"
@.str.1 = [5 x i8] c"1001\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [4 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i8* (...) @i()
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %2
br label %10
10: ; preds = %9, %0
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%12 = call i32 @sprint_nybble(i32 9, i8* %11)
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%14 = call i64 @memcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 1, i32* %2
br label %17
17: ; preds = %16, %10
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@.str = [16 x i8] c"string constant\00"
@.str.1 = [5 x i8] c"1001\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = tail call i8* (...) @i()
%3 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%6 = call i32 @sprint_nybble(i32 9, i8* %5)
%7 = call i64 @memcmp(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%8 = icmp ne i64 %7, 0
%9 = select i1 %8, i1 true, i1 %4
%10 = zext i1 %9 to i32
ret i32 %10
}