#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*/ bar(int **);
float __attribute__((no)) foo(int b) {
  int *i = 0;
  float f = 1.0;
  int **p;
  if (b)
    p = &i;
  else
    p = (int **)&f;
  bar(p);
  if (b)
    return **p;
  return f;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1147 <foo+0x37>
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    114f <foo+0x3f>
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <bar@plt>
cmpl   $0x0,-0x8(%rbp)
je     1177 <foo+0x67>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1181 <foo+0x71>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
movq   $0x0,0x10(%rsp)
movl   $0x3f800000,0xc(%rsp)
3f
test   %edi,%edi
lea    0xc(%rsp),%rax
lea    0x10(%rsp),%rbx
cmove  %rax,%rbx
mov    %rbx,%rdi
call   1030 <bar@plt>
test   %ebp,%ebp
je     114e <foo+0x3e>
mov    (%rbx),%rax
cvtsi2ssl (%rax),%xmm0
jmp    1154 <foo+0x44>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @foo(i32 %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32*
%5 = alloca float
%6 = alloca i32**
store i32 %0, i32* %3
store i32* null, i32** %4
store float 1.000000e+00, float* %5
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32** %4, i32*** %6
br label %12
10: ; preds = %1
%11 = bitcast float* %5 to i32**
store i32** %11, i32*** %6
br label %12
12: ; preds = %10, %9
%13 = load i32**, i32*** %6
%14 = call i32 @bar(i32** %13)
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32**, i32*** %6
%19 = load i32*, i32** %18
%20 = load i32, i32* %19
%21 = sitofp i32 %20 to float
store float %21, float* %2
br label %24
22: ; preds = %12
%23 = load float, float* %5
store float %23, float* %2
br label %24
24: ; preds = %22, %17
%25 = load float, float* %2
ret float %25
}

LLVM IR (-O2):
define float @foo(i32 %0) {
%2 = alloca i32*
%3 = alloca float
%4 = bitcast i32** %2 to i8*
store i32* null, i32** %2
%5 = bitcast float* %3 to i8*
store float 1.000000e+00, float* %3
%6 = icmp eq i32 %0, 0
%7 = bitcast float* %3 to i32**
%8 = select i1 %6, i32** %7, i32** %2
%9 = call i32 @bar(i32** %8)
br i1 %6, label %14, label %10
10: ; preds = %1
%11 = load i32*, i32** %8
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to float
br label %16
14: ; preds = %1
%15 = load float, float* %3
br label %16
16: ; preds = %14, %10
%17 = phi float [ %13, %10 ], [ %15, %14 ]
ret float %17
}