#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 *, char *, unsigned int, char *, unsigned int,
                          char *);
void test(char *what, unsigned expected, unsigned got) {
  printf("%s %d %s %d %s\n", what, expected,
         got == expected ? " == " : " != ", got,
         got == expected ? " OK" : " FAILED!");
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%r8d
lea    0xede(%rip),%rcx
lea    0xed2(%rip),%rax
cmp    %r8d,%edi
cmove  %rax,%rcx
mov    -0x10(%rbp),%r8d
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%r10d
lea    0xec7(%rip),%r9
lea    0xebc(%rip),%rax
cmp    %r10d,%edi
cmove  %rax,%r9
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    %edx,%r8d
mov    %esi,%edx
mov    %rdi,%rsi
cmp    %edx,%r8d
lea    0xeee(%rip),%rax
lea    0xeec(%rip),%rcx
cmove  %rax,%rcx
lea    0xee6(%rip),%rax
lea    0xee3(%rip),%r9
cmove  %rax,%r9
lea    0xeba(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%s %d %s %d %s\0A\00"
@.str.1 = [5 x i8] c" == \00"
@.str.2 = [5 x i8] c" != \00"
@.str.3 = [4 x i8] c" OK\00"
@.str.4 = [9 x i8] c" FAILED!\00"
define void @test(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = icmp eq i32 %9, %10
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%14 = load i32, i32* %6
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = icmp eq i32 %15, %16
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0)
%20 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %13, i32 %14, i8* %19)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s %d %s %d %s\0A\00"
@.str.1 = [5 x i8] c" == \00"
@.str.2 = [5 x i8] c" != \00"
@.str.3 = [4 x i8] c" OK\00"
@.str.4 = [9 x i8] c" FAILED!\00"
define void @test(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, %1
%5 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%6 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %5, i32 %2, i8* %6)
ret void
}