Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"

declare i32 @main2()
declare i7* @ctime2(i999*)

define i7* @ctime(i999*) {
; CHECK-LABEL: @ctime(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[I0:%.*]] = call i32 @main2()
; CHECK-NEXT:    [[TMP1:%.*]] = inttoptr i32 [[I0]] to i7*
; CHECK-NEXT:    ret i7* [[TMP1]]
;
entry:
  %i0 = call i7* bitcast (i32 ()* @main2 to i7* ()*)( )
  ret i7* %i0
}

define i32 @main() {
; CHECK-LABEL: @main(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[I1:%.*]] = call i7* @ctime2(i999* null)
; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint i7* [[I1]] to i32
; CHECK-NEXT:    ret i32 [[TMP0]]
;
entry:
  %i1 = call i32 bitcast (i7* (i999*)* @ctime2 to i32 (i99*)*)( i99* null )
  ret i32 %i1
}