-
-
Save fjolnir/2841580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) { | |
volatile int i= 1; | |
int a = 0; | |
if(i == 1) { | |
printf("foo\n"); | |
a=1; | |
} else { | |
printf("bar\n"); | |
a = 0; | |
} | |
return a; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'Untitled 12.m' | |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" | |
target triple = "x86_64-apple-macosx10.7.4" | |
@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip" | |
@llvm.used = appending global [1 x i8*] [i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*)], section "llvm.metadata" | |
@str = internal constant [4 x i8] c"foo\00" | |
@str2 = internal constant [4 x i8] c"bar\00" | |
define i32 @main(i32 %argc, i8** nocapture %argv) nounwind ssp { | |
%i = alloca i32, align 4 | |
volatile store i32 1, i32* %i, align 4 | |
%1 = volatile load i32* %i, align 4 | |
%2 = icmp eq i32 %1, 1 | |
br i1 %2, label %3, label %4 | |
; <label>:3 ; preds = %0 | |
%puts = call i32 @puts(i8* getelementptr inbounds ([4 x i8]* @str, i64 0, i64 0)) | |
br label %5 | |
; <label>:4 ; preds = %0 | |
%puts1 = call i32 @puts(i8* getelementptr inbounds ([4 x i8]* @str2, i64 0, i64 0)) | |
br label %5 | |
; <label>:5 ; preds = %4, %3 | |
%a.0 = phi i32 [ 1, %3 ], [ 0, %4 ] | |
ret i32 %a.0 | |
} | |
declare i32 @puts(i8* nocapture) nounwind |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment