#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 fun_call_by_other(int, int);
int /*<<< orphan*/ printf(char *);
int fun_do_something_1(int x, int y) {
  int result;
  if (x < 0 || y < 0) {
    return -1;
  }
  result = fun_call_by_other(x, y);
  if (result == 1) {
    printf("Do something ok.\n");
  } else if (result == 0) {
    printf("Do something not ready.\n");
  } else {
    printf("Do something failed.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<fun_do_something_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1142 <fun_do_something_1+0x22>
cmpl   $0x0,-0xc(%rbp)
jge    114e <fun_do_something_1+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11aa <fun_do_something_1+0x8a>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <fun_call_by_other@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1177 <fun_do_something_1+0x57>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <fun_do_something_1+0x83>
cmpl   $0x0,-0x10(%rbp)
jne    1192 <fun_do_something_1+0x72>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <fun_do_something_1+0x7e>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <fun_do_something_1+0x83>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_do_something_1>:
mov    %esi,%eax
or     %edi,%eax
js     115a <fun_do_something_1+0x3a>
push   %rax
call   1040 <fun_call_by_other@plt>
test   %eax,%eax
lea    0xee0(%rip),%rcx
lea    0xec4(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x1,%eax
lea    0xee3(%rip),%rdi
cmovne %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Do something ok.\0A\00"
@.str.1 = [25 x i8] c"Do something not ready.\0A\00"
@.str.2 = [22 x i8] c"Do something failed.\0A\00"
define i32 @fun_do_something_1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9, %2
store i32 -1, i32* %3
br label %30
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @fun_call_by_other(i32 %14, i32 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %29
21: ; preds = %13
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %28
26: ; preds = %21
%27 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
br label %29
29: ; preds = %28, %19
store i32 0, i32* %3
br label %30
30: ; preds = %29, %12
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@str = [21 x i8] c"Do something failed.\00"
@str.3 = [24 x i8] c"Do something not ready.\00"
@str.4 = [17 x i8] c"Do something ok.\00"
define i32 @fun_do_something_1(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i32 @fun_call_by_other(i32 %0, i32 %1)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0)
%9 = icmp eq i32 %6, 1
%10 = select i1 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0), i8* %8
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %5, %2
%13 = phi i32 [ -1, %2 ], [ 0, %5 ]
ret i32 %13
}