; ModuleID = '/tmp/tmpJctwj0/bug.bc' ; just an asm validation check, no output target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %"class.test::Processor" = type { i32, %"class.test::StateMachine" } %"class.test::StateMachine" = type { { i32, i32 } } @_ZN4test9ProcessorC1Ev = alias internal void (%"class.test::Processor"*)* @_ZN4test9ProcessorC2Ev @_ZN4test9ProcessorD1Ev = alias internal void (%"class.test::Processor"*)* @_ZN4test9ProcessorD2Ev define internal void @_ZN4test9ProcessorC2Ev(%"class.test::Processor"* nocapture %this) unnamed_addr nounwind align 2 { %1 = getelementptr inbounds %"class.test::Processor"* %this, i32 0, i32 0 store i32 0, i32* %1, align 4 %2 = getelementptr inbounds %"class.test::Processor"* %this, i32 0, i32 1, i32 0 store { i32, i32 } zeroinitializer, { i32, i32 }* %2, align 4 ret void } define internal void @_ZN4test9ProcessorD2Ev(%"class.test::Processor"* nocapture %this) unnamed_addr nounwind readnone align 2 { ret void } define internal zeroext i1 @_ZN4test9Processor16handleFirstStateEv(%"class.test::Processor"* nocapture %this) align 2 { %1 = tail call i32 @rand() %2 = getelementptr inbounds %"class.test::Processor"* %this, i32 0, i32 0 %3 = load i32* %2, align 4 %4 = add nsw i32 %3, %1 store i32 %4, i32* %2, align 4 %5 = and i32 %4, 1 %6 = icmp eq i32 %5, 0 ret i1 %6 } declare i32 @rand() define internal zeroext i1 @_ZN4test9Processor15handleLastStateEv(%"class.test::Processor"* nocapture %this) align 2 { %1 = tail call i32 @rand() %2 = getelementptr inbounds %"class.test::Processor"* %this, i32 0, i32 0 %3 = load i32* %2, align 4 %4 = add nsw i32 %3, %1 store i32 %4, i32* %2, align 4 ret i1 true } define internal zeroext i1 @_ZN4test9Processor3runEv(%"class.test::Processor"* %this) align 2 { %1 = getelementptr inbounds %"class.test::Processor"* %this, i32 0, i32 1, i32 0 store { i32, i32 } { i32 ptrtoint (i1 (%"class.test::Processor"*)* @_ZN4test9Processor16handleFirstStateEv to i32), i32 0 }, { i32, i32 }* %1, align 4 %2 = bitcast %"class.test::Processor"* %this to i8* br label %.backedge .backedge: ; preds = %25, %..backedge_crit_edge, %0 %3 = phi { i32, i32 } [ { i32 ptrtoint (i1 (%"class.test::Processor"*)* @_ZN4test9Processor16handleFirstStateEv to i32), i32 0 }, %0 ], [ %.pre.pre, %..backedge_crit_edge ], [ { i32 ptrtoint (i1 (%"class.test::Processor"*)* @_ZN4test9Processor15handleLastStateEv to i32), i32 0 }, %25 ] %.fca.0.extract = extractvalue { i32, i32 } %3, 0 %.fca.1.extract = extractvalue { i32, i32 } %3, 1 %4 = icmp ne i32 %.fca.0.extract, ptrtoint (i1 (%"class.test::Processor"*)* @_ZN4test9Processor15handleLastStateEv to i32) %5 = icmp ne i32 %.fca.0.extract, 0 %6 = icmp ne i32 %.fca.1.extract, 0 %7 = and i1 %5, %6 %8 = or i1 %4, %7 %9 = getelementptr inbounds i8* %2, i32 %.fca.1.extract %10 = bitcast i8* %9 to %"class.test::Processor"* %11 = and i32 %.fca.0.extract, 1 %12 = icmp eq i32 %11, 0 br i1 %12, label %20, label %13 ;