xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int errno;
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ printError(int);
FILE *openLog(const char *fileName) {
  FILE *file;
  int errnum;
  file = fopen(fileName, "w+");
  if (file == NULL) {
    errnum = errno;
    printError(errnum);
  }
  return file;
}


x86 assembly (clang, -O0):
<openLog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115f <openLog+0x3f>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <printError@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openLog>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <openLog+0x23>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <printError@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"w+\00"
@errno = global i32 0
define i32* @openLog(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @errno
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @printError(i32 %11)
br label %13
13: ; preds = %9, %1
%14 = load i32*, i32** %3
ret i32* %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"w+\00"
@errno = global i32 0
define noalias i32* @openLog(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @printError(i32 %5)
br label %7
7: ; preds = %4, %1
ret i32* %2
}
void gdk_window_set_icon() {}


x86 assembly (clang, -O0):
<gdk_window_set_icon>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdk_window_set_icon>:
ret

LLVM IR (-O0):
define void @gdk_window_set_icon() {
ret void
}

LLVM IR (-O2):
define void @gdk_window_set_icon() {
ret void
}
/* Variables and functions */
char *getExecutableName();
int /*<<< orphan*/ printf(char *, char *);
void printInvocationDescription(void) {
  printf("Usage: %s [options] [file(s)]\n", getExecutableName());
}


x86 assembly (clang, -O0):
<printInvocationDescription>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getExecutableName@plt>
mov    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printInvocationDescription>:
push   %rax
xor    %eax,%eax
call   1030 <getExecutableName@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: %s [options] [file(s)]\0A\00"
define void @printInvocationDescription() {
%1 = call i8* (...) @getExecutableName()
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: %s [options] [file(s)]\0A\00"
define void @printInvocationDescription() {
%1 = tail call i8* (...) @getExecutableName()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
unsigned xrop3_92_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = S ^ D;
  stk2 = T | stk3;
  stk1 = D ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_92_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_92_0_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
xor    $0xff,%eax
or     %ecx,%eax
xor    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_92_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = xor i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
ret i32 %32
}

LLVM IR (-O2):
define i32 @xrop3_92_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %4, 255
%8 = or i32 %6, %7
%9 = xor i32 %8, 255
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ ts_die(int /*<<< orphan*/);
void panic(void) { ts_die(strerror(errno)); }


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %eax,%edi
call   1040 <ts_die@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<panic>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ts_die@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @panic() {
%1 = load i32, i32* @errno
%2 = call i32 @strerror(i32 %1)
%3 = call i32 @ts_die(i32 %2)
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @panic() {
%1 = load i32, i32* @errno
%2 = tail call i32 @strerror(i32 %1)
%3 = tail call i32 @ts_die(i32 %2)
ret void
}
long fact(int x) {
  if (x <= 1)
    return 1;
  else
    return x + fact(x - 1);
}


x86 assembly (clang, -O0):
<fact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     1132 <fact+0x22>
movq   $0x1,-0x8(%rbp)
jmp    1153 <fact+0x43>
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fact@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fact>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     112b <fact+0x2b>
mov    %edi,%ecx
lea    -0x1(%rcx),%rax
lea    -0x2(%rdi),%edx
imul   %rdx,%rax
add    $0xfffffffd,%edi
imul   %rdx,%rdi
shr    %rdi
add    %rcx,%rax
sub    %rdi,%rax
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @fact(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 1, i64* %2
br label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call i64 @fact(i32 %11)
%13 = add nsw i64 %9, %12
store i64 %13, i64* %2
br label %14
14: ; preds = %7, %6
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @fact(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = add nsw i64 %4, -1
%6 = add nsw i32 %0, -2
%7 = zext i32 %6 to i64
%8 = mul nuw nsw i64 %5, %7
%9 = zext i32 %6 to i64
%10 = add nsw i32 %0, -3
%11 = zext i32 %10 to i64
%12 = mul nuw nsw i64 %9, %11
%13 = lshr i64 %12, 1
%14 = add nuw nsw i64 %8, %4
%15 = sub nsw i64 %14, %13
%16 = add nsw i64 %15, 1
br label %17
17: ; preds = %3, %1
%18 = phi i64 [ 1, %1 ], [ %16, %3 ]
ret i64 %18
}
/* Variables and functions */
int mount(char *, char *, char *, int, char *);
int np_mount(char *mntpt, int mntflags, char *opts) {
  return mount("none", mntpt, "9p", mntflags, opts);
}


x86 assembly (clang, -O0):
<np_mount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xecb(%rip),%rdi
lea    0xec9(%rip),%rdx
call   1030 <mount@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<np_mount>:
mov    %rdx,%r8
mov    %esi,%ecx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
lea    0xedf(%rip),%rdx
jmp    1030 <mount@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"none\00"
@.str.1 = [3 x i8] c"9p\00"
define i32 @np_mount(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"none\00"
@.str.1 = [3 x i8] c"9p\00"
define i32 @np_mount(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ wildcards_aux(char *, int /*<<< orphan*/);
void wildcards(char *str) { wildcards_aux(str, 0); }


x86 assembly (clang, -O0):
<wildcards>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <wildcards_aux@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wildcards>:
xor    %esi,%esi
jmp    1030 <wildcards_aux@plt>

LLVM IR (-O0):
define void @wildcards(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @wildcards_aux(i8* %3, i32 0)
ret void
}

LLVM IR (-O2):
define void @wildcards(i8* %0) {
%2 = tail call i32 @wildcards_aux(i8* %0, i32 0)
ret void
}
void _M2_EXCEPTIONS_finish(__attribute__((unused)) int argc,
                           __attribute__((unused)) char *argv[]) {}


x86 assembly (clang, -O0):
<_M2_EXCEPTIONS_finish>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_M2_EXCEPTIONS_finish>:
ret

LLVM IR (-O0):
define void @_M2_EXCEPTIONS_finish(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @_M2_EXCEPTIONS_finish(i32 %0, i8** nocapture %1) {
ret void
}
int astrlen(char *str) {
  int i = 0;
  for (i = 0; str[i] != '\0'; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<astrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     113e <astrlen+0x3e>
jmp    1130 <astrlen+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <astrlen+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<astrlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <astrlen+0x10>
ret

LLVM IR (-O0):
define i32 @astrlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @astrlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ stat(char *, struct stat *);
int PathIsDir(char *path) {
  struct stat statbuf;
  stat(path, &statbuf);
  if (S_ISDIR(statbuf.st_mode))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<PathIsDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1157 <PathIsDir+0x37>
movl   $0x1,-0x4(%rbp)
jmp    115e <PathIsDir+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PathIsDir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @PathIsDir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISDIR(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @PathIsDir(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call i64 @S_ISDIR(i32 %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ write_src(char *);
void decvar_handler(void) {
  write_src("varid_t varid = read_varid();\n");
  write_src("if(varid < MAX_VARS)\n");
  write_src("--vars[varid].val;\n");
}


x86 assembly (clang, -O0):
<decvar_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xef8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xf02(%rip),%rdi
call   1030 <write_src@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<decvar_handler>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xefb(%rip),%rdi
call   1030 <write_src@plt>
lea    0xf05(%rip),%rdi
pop    %rax
jmp    1030 <write_src@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"varid_t varid = read_varid();\0A\00"
@.str.1 = [22 x i8] c"if(varid < MAX_VARS)\0A\00"
@.str.2 = [20 x i8] c"--vars[varid].val;\0A\00"
define void @decvar_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"varid_t varid = read_varid();\0A\00"
@.str.1 = [22 x i8] c"if(varid < MAX_VARS)\0A\00"
@.str.2 = [20 x i8] c"--vars[varid].val;\0A\00"
define void @decvar_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write_src(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void p(char *s) { printf("%s", s); }


x86 assembly (clang, -O0):
<p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @p(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @p(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned int gm_switch_cost(unsigned int state[], const int k, const int j) {
  static const unsigned int switch_costs[6][6] = {
      {0, (13 + 2) * 6, 13 * 6, 13 * 6, 13 * 6, (13 + 9) * 6},
      {10 * 6, 0, 10 * 6, 10 * 6, 10 * 6, (10 + 9) * 6},
      {5 * 6, (5 + 2) * 6, 0, 5 * 6, 7 * 6, (7 + 9) * 6},
      {5 * 6, (5 + 2) * 6, 5 * 6, 0, 7 * 6, (7 + 9) * 6},
      {10 * 6, (10 + 2) * 6, 10 * 6, 10 * 6, 0, (10 + 9) * 6},
      {4 * 6, (4 + 2) * 6, 4 * 6, 4 * 6, 4 * 6, 0},
  };
  (void)state;
  return switch_costs[k][j];
}


x86 assembly (clang, -O0):
<gm_switch_cost>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%rbp),%rcx
lea    0xee7(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gm_switch_cost>:
movslq %esi,%rax
movslq %edx,%rcx
lea    (%rax,%rax,2),%rax
lea    0xeef(%rip),%rdx
lea    (%rdx,%rax,8),%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
@gm_switch_cost.switch_costs = internal constant [6 x [6 x i32]] [[6 x i32] [i32 0, i32 90, i32 78, i32 78, i32 78, i32 132], [6 x i32] [i32 60, i32 0, i32 60, i32 60, i32 60, i32 114], [6 x i32] [i32 30, i32 42, i32 0, i32 30, i32 42, i32 96], [6 x i32] [i32 30, i32 42, i32 30, i32 0, i32 42, i32 96], [6 x i32] [i32 60, i32 72, i32 60, i32 60, i32 0, i32 114], [6 x i32] [i32 24, i32 36, i32 24, i32 24, i32 24, i32 0]]
define i32 @gm_switch_cost(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [6 x [6 x i32]], [6 x [6 x i32]]* @gm_switch_cost.switch_costs, i64 0, i64 %9
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %10, i64 0, i64 %12
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
@gm_switch_cost.switch_costs = internal unnamed_addr constant [6 x [6 x i32]] [[6 x i32] [i32 0, i32 90, i32 78, i32 78, i32 78, i32 132], [6 x i32] [i32 60, i32 0, i32 60, i32 60, i32 60, i32 114], [6 x i32] [i32 30, i32 42, i32 0, i32 30, i32 42, i32 96], [6 x i32] [i32 30, i32 42, i32 30, i32 0, i32 42, i32 96], [6 x i32] [i32 60, i32 72, i32 60, i32 60, i32 0, i32 114], [6 x i32] [i32 24, i32 36, i32 24, i32 24, i32 24, i32 0]]
define i32 @gm_switch_cost(i32* nocapture readnone %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [6 x [6 x i32]], [6 x [6 x i32]]* @gm_switch_cost.switch_costs, i64 0, i64 %4, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int create_dobldobl_homotopy(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(172, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<create_dobldobl_homotopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xac,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_dobldobl_homotopy>:
mov    $0xac,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @create_dobldobl_homotopy() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 172, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @create_dobldobl_homotopy() {
%1 = tail call i32 @_ada_use_c2phc(i32 172, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
const char *mode2str(int mode) {
  if (mode == 1)
    return "all";
  else if (mode == 2)
    return "badlist";
  else if (mode == 3)
    return "goodlist";
  else
    return "undefined";
}


x86 assembly (clang, -O0):
<mode2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1121 <mode2str+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <mode2str+0x60>
cmpl   $0x2,-0xc(%rbp)
jne    113b <mode2str+0x3b>
lea    0xed2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <mode2str+0x60>
cmpl   $0x3,-0xc(%rbp)
jne    1155 <mode2str+0x55>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <mode2str+0x60>
lea    0xeb9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode2str>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     111a <mode2str+0x1a>
movslq %edi,%rax
lea    0xf0e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xef4(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"all\00"
@.str.1 = [8 x i8] c"badlist\00"
@.str.2 = [9 x i8] c"goodlist\00"
@.str.3 = [10 x i8] c"undefined\00"
define i8* @mode2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
15: ; preds = %11
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %14, %10, %6
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [4 x i8] c"all\00"
@.str.1 = [8 x i8] c"badlist\00"
@.str.2 = [9 x i8] c"goodlist\00"
@.str.3 = [10 x i8] c"undefined\00"
@reltable.mode2str = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.mode2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.mode2str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.mode2str to i64)) to i32)]
define i8* @mode2str(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.mode2str to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
void foo() {
  extern __thread int l1;
  static __thread int l2;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
ret

LLVM IR (-O0):
@foo.l2 = internal thread_local global i32 0
define void @foo() {
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
int GLUE_POP_FPSTACK_TO_PTR(unsigned char *buf, void *destptr) {
  if (buf) {
    *buf++ = 0xB8;
    *(void **)buf = destptr;
    buf += 4;
    *buf++ = 0xDD;
    *buf++ = 0x18;
  }
  return 1 + 4 + 2;
}


x86 assembly (clang, -O0):
<GLUE_POP_FPSTACK_TO_PTR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1164 <GLUE_POP_FPSTACK_TO_PTR+0x64>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0xb8,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0xdd,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x18,(%rax)
mov    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLUE_POP_FPSTACK_TO_PTR>:
test   %rdi,%rdi
je     1112 <GLUE_POP_FPSTACK_TO_PTR+0x12>
movb   $0xb8,(%rdi)
mov    %rsi,0x1(%rdi)
movw   $0x18dd,0x5(%rdi)
mov    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @GLUE_POP_FPSTACK_TO_PTR(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %3
store i8 -72, i8* %8
%10 = load i8*, i8** %4
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to i8**
store i8* %10, i8** %12
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 4
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
store i8 -35, i8* %15
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
store i8 24, i8* %17
br label %19
19: ; preds = %7, %2
ret i32 7
}

LLVM IR (-O2):
define i32 @GLUE_POP_FPSTACK_TO_PTR(i8* writeonly %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 -72, i8* %0
%6 = bitcast i8* %5 to i8**
store i8* %1, i8** %6
%7 = getelementptr inbounds i8, i8* %0, i64 5
%8 = getelementptr inbounds i8, i8* %0, i64 6
store i8 -35, i8* %7
store i8 24, i8* %8
br label %9
9: ; preds = %4, %2
ret i32 7
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int read_start_system_without_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(151, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<read_start_system_without_solutions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x97,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_start_system_without_solutions>:
mov    $0x97,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @read_start_system_without_solutions() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 151, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @read_start_system_without_solutions() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 151, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a[12] = {1, 3, 5, 4, 7, 2, 99, 16, 45, 67, 89, 45};
  int i;
  int total = 0;
  for (i = 0; i < 12; i++) {
    total += a[i];
  }
  printf("Total de valores dos elementos do array é %d\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xc,-0x44(%rbp)
jge    1178 <main+0x58>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1152 <main+0x32>
mov    -0x48(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x17f,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.a = [12 x i32] [i32 1, i32 3, i32 5, i32 4, i32 7, i32 2, i32 99, i32 16, i32 45, i32 67, i32 89, i32 45]
@.str = [47 x i8] c"Total de valores dos elementos do array \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [12 x i32]* %2 to i8*
store i32 0, i32* %4
store i32 0, i32* %3
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 12
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %4
%15 = add nsw i32 %14, %13
store i32 %15, i32* %4
br label %16
16: ; preds = %9
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %6
19: ; preds = %6
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"Total de valores dos elementos do array \C3\A9 %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 383)
ret i32 0
}
__attribute__((always_)) int
mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) {
  return 0;
}


x86 assembly (clang, -O0):
<mpol_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpol_to_str>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.mempolicy = type opaque
define i32 @mpol_to_str(i8* %0, i32 %1, %struct.mempolicy* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.mempolicy*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store %struct.mempolicy* %2, %struct.mempolicy** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.mempolicy = type opaque
define i32 @mpol_to_str(i8* nocapture readnone %0, i32 %1, %struct.mempolicy* nocapture readnone %2, i32 %3) {
ret i32 0
}
void __attribute__((noreturn)) abort(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <abort+0x9>
jmp    1109 <abort+0x9>

x86 assembly (clang, -O2):
<abort>:
jmp    1100 <abort>

LLVM IR (-O0):
define void @abort() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @abort() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ SetPenWidth82(unsigned long);
void setpenwidth(unsigned long pew) { SetPenWidth82(pew); }


x86 assembly (clang, -O0):
<setpenwidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <SetPenWidth82@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setpenwidth>:
jmp    1030 <SetPenWidth82@plt>

LLVM IR (-O0):
define void @setpenwidth(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @SetPenWidth82(i64 %3)
ret void
}

LLVM IR (-O2):
define void @setpenwidth(i64 %0) {
%2 = tail call i32 @SetPenWidth82(i64 %0)
ret void
}
long __attribute__((no, noclone)) fn2(unsigned long int ul) {
  return (-(long)(ul - 1UL)) - 1L;
}


x86 assembly (clang, -O0):
<fn2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
xor    %eax,%eax
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn2>:
mov    %rdi,%rax
neg    %rax
ret

LLVM IR (-O0):
define i64 @fn2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub i64 %3, 1
%5 = sub nsw i64 0, %4
%6 = sub nsw i64 %5, 1
ret i64 %6
}

LLVM IR (-O2):
define i64 @fn2(i64 %0) {
%2 = sub i64 0, %0
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, double);
void sprintf_generic_default(double x) {
  char buf[64];
  snprintf(buf, 64, "%g", x);
}


x86 assembly (clang, -O0):
<sprintf_generic_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
mov    $0x40,%esi
lea    0xece(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprintf_generic_default>:
sub    $0x48,%rsp
lea    0xee5(%rip),%rdx
mov    %rsp,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%g\00"
define void @sprintf_generic_default(double %0) {
%2 = alloca double
%3 = alloca [64 x i8]
store double %0, double* %2
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = load double, double* %2
%6 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %5)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%g\00"
define void @sprintf_generic_default(double %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
void init(int *n, int *dummy) {
  if (0 == n)
    dummy[0] = 0;
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    1122 <init+0x22>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
test   %rdi,%rdi
je     1106 <init+0x6>
ret
movl   $0x0,(%rsi)
ret

LLVM IR (-O0):
define void @init(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = icmp eq i32* null, %5
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 0, i32* %9
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @init(i32* readnone %0, i32* nocapture writeonly %1) {
%3 = icmp eq i32* %0, null
br i1 %3, label %4, label %5
4: ; preds = %2
store i32 0, i32* %1
br label %5
5: ; preds = %4, %2
ret void
}
int zip_lba_to_msf_accurate(int lba) {
  int temp_pos;
  int m, s, f;
  temp_pos = lba + 150;
  f = temp_pos % 75;
  temp_pos -= f;
  temp_pos /= 75;
  s = temp_pos % 60;
  temp_pos -= s;
  temp_pos /= 60;
  m = temp_pos;
  return ((m << 16) | (s << 8) | f);
}


x86 assembly (clang, -O0):
<zip_lba_to_msf_accurate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x96,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4b,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4b,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x10,%eax
mov    -0x10(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zip_lba_to_msf_accurate>:
add    $0x96,%edi
movslq %edi,%rax
imul   $0x1b4e81b5,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x3,%ecx
add    %edx,%ecx
imul   $0x4b,%ecx,%edx
imul   $0x7482296b,%rax,%rsi
mov    %eax,%edi
sub    %edx,%edi
movslq %ecx,%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
mov    %rsi,%rcx
shr    $0x3f,%rcx
shr    $0x2b,%rsi
add    %ecx,%esi
shl    $0x10,%esi
or     %edi,%esi
shl    $0x8,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @zip_lba_to_msf_accurate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 150
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = srem i32 %9, 75
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 75
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = srem i32 %16, 60
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = sdiv i32 %21, 60
store i32 %22, i32* %3
%23 = load i32, i32* %3
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = shl i32 %24, 16
%26 = load i32, i32* %5
%27 = shl i32 %26, 8
%28 = or i32 %25, %27
%29 = load i32, i32* %6
%30 = or i32 %28, %29
ret i32 %30
}

LLVM IR (-O2):
define i32 @zip_lba_to_msf_accurate(i32 %0) {
%2 = add nsw i32 %0, 150
%3 = srem i32 %2, 75
%4 = sdiv i32 %2, 75
%5 = srem i32 %4, 60
%6 = sdiv i32 %2, 4500
%7 = shl i32 %6, 16
%8 = shl nsw i32 %5, 8
%9 = or i32 %7, %3
%10 = or i32 %9, %8
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ sync_time_send();
void sync_time() { sync_time_send(); }


x86 assembly (clang, -O0):
<sync_time>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sync_time_send@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync_time>:
xor    %eax,%eax
jmp    1030 <sync_time_send@plt>

LLVM IR (-O0):
define void @sync_time() {
%1 = call i32 (...) @sync_time_send()
ret void
}

LLVM IR (-O2):
define void @sync_time() {
%1 = tail call i32 (...) @sync_time_send()
ret void
}
/* Variables and functions */
void CL_JoystickEvent(int axis, int value, int time) {}


x86 assembly (clang, -O0):
<CL_JoystickEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_JoystickEvent>:
ret

LLVM IR (-O0):
define void @CL_JoystickEvent(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @CL_JoystickEvent(i32 %0, i32 %1, i32 %2) {
ret void
}
int dec2char(int c) {
  if ((c >= 0) && (c <= 9))
    return (c + 48);
  else
    return -1;
}


x86 assembly (clang, -O0):
<dec2char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1129 <dec2char+0x29>
cmpl   $0x9,-0x8(%rbp)
jg     1129 <dec2char+0x29>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1130 <dec2char+0x30>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec2char>:
lea    0x30(%rdi),%ecx
cmp    $0xa,%edi
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @dec2char(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 9
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 48
store i32 %11, i32* %2
br label %13
12: ; preds = %6, %1
store i32 -1, i32* %2
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @dec2char(i32 %0) {
%2 = icmp ult i32 %0, 10
%3 = add nsw i32 %0, 48
%4 = select i1 %2, i32 %3, i32 -1
ret i32 %4
}
/* Variables and functions */
char *strchr(const char *s, int c) {
  for (size_t i = 0; s[i] != '\0'; ++i) {
    if (s[i] == c) {
      return (char *)&s[i];
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <strchr+0x64>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    -0x14(%rbp),%eax
jne    114e <strchr+0x4e>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116c <strchr+0x6c>
jmp    1153 <strchr+0x53>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1113 <strchr+0x13>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr+0x23>
mov    %rdi,%rax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     1125 <strchr+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @strchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 0, i64* %6
br label %7
7: ; preds = %27, %2
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %7
%15 = load i8*, i8** %4
%16 = load i64, i64* %6
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i32, i32* %5
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %26
22: ; preds = %14
%23 = load i8*, i8** %4
%24 = load i64, i64* %6
%25 = getelementptr inbounds i8, i8* %23, i64 %24
store i8* %25, i8** %3
br label %31
26: ; preds = %14
br label %27
27: ; preds = %26
%28 = load i64, i64* %6
%29 = add i64 %28, 1
store i64 %29, i64* %6
br label %7
30: ; preds = %7
store i8* null, i8** %3
br label %31
31: ; preds = %30, %22
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %13, %10 ], [ %3, %2 ]
%7 = phi i64 [ %11, %10 ], [ 0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = add i64 %7, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %17, label %5
15: ; preds = %5
%16 = getelementptr inbounds i8, i8* %0, i64 %7
br label %17
17: ; preds = %10, %2, %15
%18 = phi i8* [ %16, %15 ], [ null, %2 ], [ null, %10 ]
ret i8* %18
}
void beganTest(void *ctx_) { (void)ctx_; }


x86 assembly (clang, -O0):
<beganTest>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<beganTest>:
ret

LLVM IR (-O0):
define void @beganTest(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @beganTest(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ simputc(char);
extern void simputh(unsigned long int i) {
  char lsd = i & 0xf;
  char ch = lsd < 10 ? '0' + lsd : 'A' + lsd - 10;
  if (i > 0) {
    simputh(i >> 4);
  }
  simputc(ch);
}


x86 assembly (clang, -O0):
<simputh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xf,%rax
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jge    1153 <simputh+0x33>
movsbl -0x9(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x10(%rbp)
jmp    1160 <simputh+0x40>
movsbl -0x9(%rbp),%eax
add    $0x41,%eax
sub    $0xa,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,-0xa(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    117e <simputh+0x5e>
mov    -0x8(%rbp),%rdi
shr    $0x4,%rdi
call   1030 <simputh@plt>
movsbl -0xa(%rbp),%edi
call   1040 <simputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simputh>:
push   %rbx
mov    %edi,%ebx
and    $0xf,%ebx
test   %rdi,%rdi
je     1134 <simputh+0x14>
shr    $0x4,%rdi
call   1030 <simputh@plt>
lea    0x30(%rbx),%eax
lea    0x37(%rbx),%edi
cmp    $0xa,%ebx
cmovb  %eax,%edi
pop    %rbx
jmp    1040 <simputc@plt>

LLVM IR (-O0):
define void @simputh(i64 %0) {
%2 = alloca i64
%3 = alloca i8
%4 = alloca i8
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = and i64 %5, 15
%7 = trunc i64 %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = add nsw i32 48, %13
br label %20
15: ; preds = %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = add nsw i32 65, %17
%19 = sub nsw i32 %18, 10
br label %20
20: ; preds = %15, %11
%21 = phi i32 [ %14, %11 ], [ %19, %15 ]
%22 = trunc i32 %21 to i8
store i8 %22, i8* %4
%23 = load i64, i64* %2
%24 = icmp ugt i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i64, i64* %2
%27 = lshr i64 %26, 4
br label %28
28: ; preds = %25, %20
%29 = load i8, i8* %4
%30 = call i32 @simputc(i8 signext %29)
ret void
}

LLVM IR (-O2):
define void @simputh(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 15
%4 = icmp eq i64 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = lshr i64 %0, 4
tail call void @simputh(i64 %6)
br label %7
7: ; preds = %5, %1
%8 = icmp ult i32 %3, 10
%9 = or i32 %3, 48
%10 = add nuw nsw i32 %3, 55
%11 = select i1 %8, i32 %9, i32 %10
%12 = trunc i32 %11 to i8
%13 = tail call i32 @simputc(i8 signext %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(char *);
int main(void) {
  char a[10];
  foo(a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0xa(%rbp),%rdi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xe(%rsp),%rdi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @foo(i8* %2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @foo(i8* %2)
ret i32 0
}