xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ free(char *);
char *get_sysfs_str(char *);
int /*<<< orphan*/ sscanf(char *, char *, void *);
int _get_sysfs_numeric(char *sysfs_attr, char *fmt, void *value) {
  char *string;
  if ((string = get_sysfs_str(sysfs_attr)) == NULL)
    return -1;
  errno = 0;
  sscanf(string, fmt, value);
  free(string);
  return 0;
}


x86 assembly (clang, -O0):
<_get_sysfs_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <get_sysfs_str@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1167 <_get_sysfs_numeric+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    1196 <_get_sysfs_numeric+0x66>
mov    0x2e72(%rip),%rax
movq   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_sysfs_numeric>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1050 <get_sysfs_str@plt>
test   %rax,%rax
je     1170 <_get_sysfs_numeric+0x40>
mov    %rax,%rbx
mov    0x2e91(%rip),%rax
movq   $0x0,(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <sscanf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    1175 <_get_sysfs_numeric+0x45>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
define i32 @_get_sysfs_numeric(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = call i8* @get_sysfs_str(i8* %9)
store i8* %10, i8** %8
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 -1, i32* %4
br label %20
13: ; preds = %3
store i64 0, i64* @errno
%14 = load i8*, i8** %8
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = call i32 @sscanf(i8* %14, i8* %15, i8* %16)
%18 = load i8*, i8** %8
%19 = call i32 @free(i8* %18)
store i32 0, i32* %4
br label %20
20: ; preds = %13, %12
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
@errno = global i64 0
define i32 @_get_sysfs_numeric(i8* %0, i8* nocapture %1, i8* %2) {
%4 = tail call i8* @get_sysfs_str(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
store i64 0, i64* @errno
%7 = tail call i32 @sscanf(i8* %4, i8* %1, i8* %2)
%8 = tail call i32 @free(i8* %4)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %10
}
unsigned long prioq__lchild(unsigned long index) { return (index << 1) + 1; }


x86 assembly (clang, -O0):
<prioq__lchild>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prioq__lchild>:
lea    (%rdi,%rdi,1),%rax
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @prioq__lchild(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 1
%5 = add i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @prioq__lchild(i64 %0) {
%2 = shl i64 %0, 1
%3 = or i64 %2, 1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void system_call_handler() {
  printf("\n #####> Exiting on syscall !!\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<system_call_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<system_call_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"\0A #####> Exiting on syscall !!\0A\00"
define void @system_call_handler() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [31 x i8] c"\0A #####> Exiting on syscall !!\00"
define void @system_call_handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
void baz(int z) {}


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

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

LLVM IR (-O0):
define void @baz(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @baz(i32 %0) {
ret void
}
__DIT(DIT_) char DIT_;
{ (void)write(1, &DIT_, 1); }


x86 assembly (clang, -O0):
<__DIT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__DIT>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @__DIT(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 1, i8* %3, i32 1)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @__DIT(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 1, i8* %2, i32 1)
ret i32 undef
}
/* Type definitions */
struct t_config_option {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gui_bar_item_update(char *);
void config_change_item_away(const void *pointer, void *data,
                             struct t_config_option *option) {
  (void)pointer;
  (void)data;
  (void)option;
  gui_bar_item_update("away");
}


x86 assembly (clang, -O0):
<config_change_item_away>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <gui_bar_item_update@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_change_item_away>:
lea    0xee9(%rip),%rdi
jmp    1030 <gui_bar_item_update@plt>

LLVM IR (-O0):
%struct.t_config_option = type { i32 }
@.str = [5 x i8] c"away\00"
define void @config_change_item_away(i8* %0, i8* %1, %struct.t_config_option* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.t_config_option*
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.t_config_option* %2, %struct.t_config_option** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load %struct.t_config_option*, %struct.t_config_option** %6
%10 = call i32 @gui_bar_item_update(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.t_config_option = type { i32 }
@.str = [5 x i8] c"away\00"
define void @config_change_item_away(i8* nocapture readnone %0, i8* nocapture readnone %1, %struct.t_config_option* nocapture readnone %2) {
%4 = tail call i32 @gui_bar_item_update(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ calcAndPrint(char *, int);
scalar_t__ scanf(char *, char *, int *);
int main(void) {
  char R[7];
  int n;
  while (scanf("%s %d", R, &n) != EOF) {
    calcAndPrint(R, n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb(%rbp),%rsi
lea    0xec6(%rip),%rdi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
je     1164 <main+0x44>
lea    -0xb(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <calcAndPrint@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0x11(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x2ea0(%rip),%r12
cmp    (%r12),%rax
je     1180 <main+0x60>
lea    0x11(%rsp),%rbx
lea    0xea6(%rip),%r14
lea    0xc(%rsp),%r15
nop
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <calcAndPrint@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <scanf@plt>
cmp    (%r12),%rax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %d\00"
@EOF = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %9, %0
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%6 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5, i32* %3)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* %3
%12 = call i32 @calcAndPrint(i8* %10, i32 %11)
br label %4
13: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %d\00"
@EOF = global i64 0
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %14, label %8
8: ; preds = %0, %8
%9 = load i32, i32* %2
%10 = call i32 @calcAndPrint(i8* %3, i32 %9)
%11 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i32* %2)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %8
14: ; preds = %8, %0
ret i32 0
}
/* Variables and functions */
char *ckalloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *const);
scalar_t__ strlen(char const *const);
char *copy_string(const char *const str) {
  char *copy = ckalloc(strlen(str) + 1);
  strcpy(copy, str);
  return copy;
}


x86 assembly (clang, -O0):
<copy_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1030 <ckalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1030 <ckalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @copy_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @ckalloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @copy_string(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @ckalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
uintptr_t tag1(void *ptr) { return (uintptr_t)ptr | 1; }


x86 assembly (clang, -O0):
<tag1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag1>:
mov    %rdi,%rax
or     $0x1,%rax
ret

LLVM IR (-O0):
define i64 @tag1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = or i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @tag1(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = or i64 %2, 1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ AbsoluteIndexedXX0(int);
int /*<<< orphan*/ ROL16(int /*<<< orphan*/, int);
void Op3EM0X0(void) { ROL16(AbsoluteIndexedXX0(3), 0xFFFFFF); }


x86 assembly (clang, -O0):
<Op3EM0X0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <AbsoluteIndexedXX0@plt>
mov    %eax,%edi
mov    $0xffffff,%esi
call   1040 <ROL16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op3EM0X0>:
push   %rax
mov    $0x3,%edi
call   1030 <AbsoluteIndexedXX0@plt>
mov    %eax,%edi
mov    $0xffffff,%esi
pop    %rax
jmp    1040 <ROL16@plt>

LLVM IR (-O0):
define void @Op3EM0X0() {
%1 = call i32 @AbsoluteIndexedXX0(i32 3)
%2 = call i32 @ROL16(i32 %1, i32 16777215)
ret void
}

LLVM IR (-O2):
define void @Op3EM0X0() {
%1 = tail call i32 @AbsoluteIndexedXX0(i32 3)
%2 = tail call i32 @ROL16(i32 %1, i32 16777215)
ret void
}
/* Type definitions */
struct client {
  int dummy;
};
typedef int /*<<< orphan*/ Time;

/* Variables and functions */
int /*<<< orphan*/ cfocusapp(struct client *, int /*<<< orphan*/);
struct client *getfronttask();
struct client *refocus(Time time) {
  struct client *c = getfronttask();
  if (c != NULL)
    cfocusapp(c, time);
  return c;
}


x86 assembly (clang, -O0):
<refocus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getfronttask@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <refocus+0x2d>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <cfocusapp@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<refocus>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <getfronttask@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113e <refocus+0x1e>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <cfocusapp@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.client = type { i32 }
define %struct.client* @refocus(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.client*
store i32 %0, i32* %2
%4 = call %struct.client* (...) @getfronttask()
store %struct.client* %4, %struct.client** %3
%5 = load %struct.client*, %struct.client** %3
%6 = icmp ne %struct.client* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load %struct.client*, %struct.client** %3
%9 = load i32, i32* %2
%10 = call i32 @cfocusapp(%struct.client* %8, i32 %9)
br label %11
11: ; preds = %7, %1
%12 = load %struct.client*, %struct.client** %3
ret %struct.client* %12
}

LLVM IR (-O2):
%struct.client = type { i32 }
define %struct.client* @refocus(i32 %0) {
%2 = tail call %struct.client* (...) @getfronttask()
%3 = icmp eq %struct.client* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @cfocusapp(%struct.client* %2, i32 %0)
br label %6
6: ; preds = %4, %1
ret %struct.client* %2
}
int computeCoreId(int sx, int sy, int mesh_width) {
  return ((sy * mesh_width) + sx);
}


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

x86 assembly (clang, -O2):
<computeCoreId>:
imul   %edx,%esi
lea    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @computeCoreId(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* %5
%8 = load i32, i32* %6
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @computeCoreId(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = add nsw i32 %4, %0
ret i32 %5
}
int mlt_version_get_minor() { return 23; }


x86 assembly (clang, -O0):
<mlt_version_get_minor>:
push   %rbp
mov    %rsp,%rbp
mov    $0x17,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlt_version_get_minor>:
mov    $0x17,%eax
ret

LLVM IR (-O0):
define i32 @mlt_version_get_minor() {
ret i32 23
}

LLVM IR (-O2):
define i32 @mlt_version_get_minor() {
ret i32 23
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("Hello, world %d!!!\n", add(1, 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"Hello, world %d!!!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @add(i32 1, i32 2)
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Hello, world %d!!!\0A\00"
define i32 @main() {
%1 = tail call i32 @add(i32 1, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void TimerUpdateConfigure(unsigned long ulBase, unsigned long ulUpdate) {

  ;

  ;
  if (ulUpdate == 0x00000000) {
    (*((volatile unsigned long *)(ulBase + 0x00000000))) &= ~0x00000002;
  } else {
    (*((volatile unsigned long *)(ulBase + 0x00000000))) |= 0x00000002;
  }
}


x86 assembly (clang, -O0):
<TimerUpdateConfigure>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112a <TimerUpdateConfigure+0x2a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
and    $0xfffffffffffffffd,%rcx
mov    %rcx,(%rax)
jmp    1138 <TimerUpdateConfigure+0x38>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerUpdateConfigure>:
xor    %eax,%eax
test   %rsi,%rsi
setne  %al
mov    (%rdi),%rcx
and    $0xfffffffffffffffd,%rcx
lea    (%rcx,%rax,2),%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @TimerUpdateConfigure(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i64, i64* %3
%9 = add i64 %8, 0
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
%12 = and i64 %11, -3
store volatile i64 %12, i64* %10
br label %19
13: ; preds = %2
%14 = load i64, i64* %3
%15 = add i64 %14, 0
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
%18 = or i64 %17, 2
store volatile i64 %18, i64* %16
br label %19
19: ; preds = %13, %7
ret void
}

LLVM IR (-O2):
define void @TimerUpdateConfigure(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
%4 = inttoptr i64 %0 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, -3
%7 = select i1 %3, i64 0, i64 2
%8 = or i64 %6, %7
store volatile i64 %8, i64* %4
ret void
}
void _Z9_Jv_RunGCv(void) {}


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

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

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

LLVM IR (-O2):
define void @_Z9_Jv_RunGCv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int february(int year) {
  if (year < 1964 || year > 1999) {
    fprintf(stderr, "Anachronistic timestamp: year %d\n", year);
    exit(1);
  }
  if ((year % 4) == 0)
    return 29;
  else
    return 28;
}


x86 assembly (clang, -O0):
<february>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x7ac,-0x8(%rbp)
jl     1145 <february+0x25>
cmpl   $0x7cf,-0x8(%rbp)
jle    1167 <february+0x47>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xea8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1187 <february+0x67>
movl   $0x1d,-0x4(%rbp)
jmp    118e <february+0x6e>
movl   $0x1c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<february>:
mov    %edi,%edx
lea    -0x7d0(%rdx),%eax
cmp    $0xffffffdb,%eax
jbe    1139 <february+0x19>
xor    %eax,%eax
test   $0x3,%dl
sete   %al
or     $0x1c,%eax
ret
push   %rax
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Anachronistic timestamp: year %d\0A\00"
define i32 @february(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1964
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 1999
br i1 %8, label %9, label %14
9: ; preds = %6, %1
%10 = load i32, i32* @stderr
%11 = load i32, i32* %3
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %6
%15 = load i32, i32* %3
%16 = srem i32 %15, 4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 29, i32* %2
br label %20
19: ; preds = %14
store i32 28, i32* %2
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Anachronistic timestamp: year %d\0A\00"
define i32 @february(i32 %0) {
%2 = add i32 %0, -2000
%3 = icmp ult i32 %2, -36
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
%9 = and i32 %0, 3
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 29, i32 28
ret i32 %11
}
char *strUnderline(const char *in, char *out) {
  char *scan = out;
  while (*in != '\0') {
    if ((*in >= ' ') || (*in < '\0'))
      *scan++ = '-';
    in++;
  }
  *scan = '\0';
  return out;
}


x86 assembly (clang, -O0):
<strUnderline>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1167 <strUnderline+0x67>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jge    1144 <strUnderline+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jge    1156 <strUnderline+0x56>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x2d,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strUnderline+0x14>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strUnderline>:
mov    %rsi,%rax
mov    (%rdi),%dl
mov    %rsi,%rcx
test   %dl,%dl
je     1139 <strUnderline+0x39>
add    $0x1,%rdi
mov    %rax,%rcx
jmp    112b <strUnderline+0x2b>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdi),%edx
add    $0x1,%rdi
test   %dl,%dl
je     1139 <strUnderline+0x39>
cmp    $0x20,%dl
jb     1120 <strUnderline+0x20>
movb   $0x2d,(%rcx)
add    $0x1,%rcx
jmp    1120 <strUnderline+0x20>
movb   $0x0,(%rcx)
ret

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

LLVM IR (-O2):
define i8* @strUnderline(i8* nocapture %0, i8* returned writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %12
%6 = phi i8 [ %15, %12 ], [ %3, %2 ]
%7 = phi i8* [ %13, %12 ], [ %1, %2 ]
%8 = phi i8* [ %14, %12 ], [ %0, %2 ]
%9 = icmp ugt i8 %6, 31
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
store i8 45, i8* %7
br label %12
12: ; preds = %5, %10
%13 = phi i8* [ %11, %10 ], [ %7, %5 ]
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %12, %2
%18 = phi i8* [ %1, %2 ], [ %13, %12 ]
store i8 0, i8* %18
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ doCalc(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *malloc(int);
int main(int argc, char *argv[]) {
  static int key = 9973;
  static char mbuf[10240000];
  char *p;
  p = malloc(1024);
  doCalc(key);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    0x2ede(%rip),%edi
call   1030 <doCalc@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x26f5,%edi
call   1030 <doCalc@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@main.key = internal global i32 9973
@main.mbuf = internal global [10240000 x i8] zeroinitializer
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @malloc(i32 1024)
store i8* %7, i8** %6
%8 = load i32, i32* @main.key
%9 = call i32 @doCalc(i32 %8)
%10 = load i32, i32* @EXIT_SUCCESS
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @doCalc(i32 9973)
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char);
int main() {
  char a, b;
  a = 0;
  b = ~a;
  printf("a = %d, b = %d\n", a, b);
  a = 1;
  b = ~a;
  printf("a = %d, b = %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0x6(%rbp)
mov    -0x5(%rbp),%al
lea    0xec9(%rip),%rdi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1030 <printf@plt>
movb   $0x1,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0x6(%rbp)
mov    -0x5(%rbp),%al
lea    0xea5(%rip),%rdi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xfffffffe,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"a = %d, b = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = xor i32 %5, -1
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %2
%9 = load i8, i8* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext %8, i8 signext %9)
store i8 1, i8* %2
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
%15 = load i8, i8* %2
%16 = load i8, i8* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext %15, i8 signext %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"a = %d, b = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext 0, i8 signext -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext 1, i8 signext -2)
ret i32 0
}
long long_div_round(long num, long dem) {
  long divvie, moddo;
  divvie = num / dem;
  moddo = num % dem;
  if (moddo > (dem / 2))
    ++divvie;
  return divvie;
}


x86 assembly (clang, -O0):
<long_div_round>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    115a <long_div_round+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_div_round>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1116 <long_div_round+0x16>
cqto
idiv   %rsi
jmp    111a <long_div_round+0x1a>
xor    %edx,%edx
div    %esi
mov    %rsi,%rdi
shr    $0x3f,%rdi
add    %rsi,%rdi
sar    %rdi
xor    %ecx,%ecx
cmp    %rdi,%rdx
setg   %cl
add    %rax,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @long_div_round(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = sdiv i64 %7, %8
store i64 %9, i64* %5
%10 = load i64, i64* %3
%11 = load i64, i64* %4
%12 = srem i64 %10, %11
store i64 %12, i64* %6
%13 = load i64, i64* %6
%14 = load i64, i64* %4
%15 = sdiv i64 %14, 2
%16 = icmp sgt i64 %13, %15
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i64, i64* %5
%19 = add nsw i64 %18, 1
store i64 %19, i64* %5
br label %20
20: ; preds = %17, %2
%21 = load i64, i64* %5
ret i64 %21
}

LLVM IR (-O2):
define i64 @long_div_round(i64 %0, i64 %1) {
%3 = sdiv i64 %0, %1
%4 = srem i64 %0, %1
%5 = sdiv i64 %1, 2
%6 = icmp sgt i64 %4, %5
%7 = zext i1 %6 to i64
%8 = add nsw i64 %3, %7
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ l2x0_inv_all();
void l2x0_enable() {
  unsigned aux;
  if (!((*((volatile unsigned *)(0xC4200000 + 0x100))) & 1)) {
    aux = (*((volatile unsigned *)(0xC4200000 + 0x104)));
    aux &= 0xff800fff;
    aux |= 0x00020000;
    (*((volatile unsigned *)(0xC4200000 + 0x104)) = aux);
    l2x0_inv_all();
    (*((volatile unsigned *)(0xC4200000 + 0x100)) = 1);
  }
}


x86 assembly (clang, -O0):
<l2x0_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc4200100,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1167 <l2x0_enable+0x57>
mov    $0xc4200104,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff800fff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x20000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0xc4200104,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <l2x0_inv_all@plt>
mov    $0xc4200100,%eax
movl   $0x1,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l2x0_enable>:
push   %rbx
mov    $0xc4200100,%ebx
mov    (%rbx),%eax
test   $0x1,%al
jne    1139 <l2x0_enable+0x29>
mov    $0xff800fff,%eax
and    0x4(%rbx),%eax
or     $0x20000,%eax
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1030 <l2x0_inv_all@plt>
movl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @l2x0_enable() {
%1 = alloca i32
%2 = load volatile i32, i32* inttoptr (i64 3290431744 to i32*)
%3 = and i32 %2, 1
%4 = icmp ne i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %0
%6 = load volatile i32, i32* inttoptr (i64 3290431748 to i32*)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = and i32 %7, -8384513
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = or i32 %9, 131072
store i32 %10, i32* %1
%11 = load i32, i32* %1
store volatile i32 %11, i32* inttoptr (i64 3290431748 to i32*)
%12 = call i32 (...) @l2x0_inv_all()
store volatile i32 1, i32* inttoptr (i64 3290431744 to i32*)
br label %13
13: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
define void @l2x0_enable() {
%1 = load volatile i32, i32* inttoptr (i64 3290431744 to i32*)
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = load volatile i32, i32* inttoptr (i64 3290431748 to i32*)
%6 = and i32 %5, -8384513
%7 = or i32 %6, 131072
store volatile i32 %7, i32* inttoptr (i64 3290431748 to i32*)
%8 = tail call i32 (...) @l2x0_inv_all()
store volatile i32 1, i32* inttoptr (i64 3290431744 to i32*)
br label %9
9: ; preds = %4, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *const,
                           int const, char const *const, char const *const);
int /*<<< orphan*/ stderr;
__attribute__((noreturn)) void panic(char const *const file, int const line,
                                     char const *const func,
                                     char const *const msg) {
  fprintf(stderr, "%s:%d: panic in %s: %s\n", file, line, func, msg);
  abort();
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<panic>:
push   %rax
mov    %rcx,%r9
mov    %rdx,%r8
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"%s:%d: panic in %s: %s\0A\00"
define void @panic(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i8* %12, i8* %13)
%15 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"%s:%d: panic in %s: %s\0A\00"
define void @panic(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %3)
%7 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ CLI_CommDestroy();
int /*<<< orphan*/ CLI_TermDestroy();
void CLI_ProcessDestory() {
  CLI_CommDestroy();
  CLI_TermDestroy();
}


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

x86 assembly (clang, -O2):
<CLI_ProcessDestory>:
push   %rax
xor    %eax,%eax
call   1030 <CLI_CommDestroy@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <CLI_TermDestroy@plt>

LLVM IR (-O0):
define void @CLI_ProcessDestory() {
%1 = call i32 (...) @CLI_CommDestroy()
%2 = call i32 (...) @CLI_TermDestroy()
ret void
}

LLVM IR (-O2):
define void @CLI_ProcessDestory() {
%1 = tail call i32 (...) @CLI_CommDestroy()
%2 = tail call i32 (...) @CLI_TermDestroy()
ret void
}
/* Variables and functions */
int sscanf(char *, char *, long *);
int scan_hex(char *attr_str, long *majorp, long *minorp) {
  return sscanf(attr_str, "0x%lx", majorp);
}


x86 assembly (clang, -O0):
<scan_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xecd(%rip),%rsi
call   1030 <sscanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_hex>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <sscanf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"0x%lx\00"
define i32 @scan_hex(i8* nocapture %0, i64* %1, i64* nocapture readnone %2) {
%4 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %1)
ret i32 %4
}
void fn_node(unsigned int node, void *input, void *data) { return; }


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

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

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

LLVM IR (-O2):
define void @fn_node(i32 %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void printUsage(char *prog) {
  fprintf(stderr,
          "Usage: %s -j [JOB MODE] -f [IN FILE] -o [OUT FILE]\n"
          "\t-j [JOB MODE] : Crypt/Decrypt\n"
          "\t-f [IN FILE]  : File on which the job is to be done\n"
          "\t-o [OUT FILE] : Output file\n",
          prog);
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printUsage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [165 x i8] c"Usage: %s -j [JOB MODE] -f [IN FILE] -o [OUT FILE]\0A\09-j [JOB MODE] : Crypt/Decrypt\0A\09-f [IN FILE] : File on which the job is to be done\0A\09-o [OUT FILE] : Output file\0A\00"
define void @printUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [165 x i8] c"Usage: %s -j [JOB MODE] -f [IN FILE] -o [OUT FILE]\0A\09-j [JOB MODE] : Crypt/Decrypt\0A\09-f [IN FILE] : File on which the job is to be done\0A\09-o [OUT FILE] : Output file\0A\00"
define void @printUsage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int foo(int predicate) {
  if (predicate <= 0) {
    return 1;
  } else {
    if (predicate > 5)
      return 2;
    return 3;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111d <foo+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    113a <foo+0x3a>
cmpl   $0x5,-0x8(%rbp)
jle    1133 <foo+0x33>
movl   $0x2,-0x4(%rbp)
jmp    113a <foo+0x3a>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %ecx,%ecx
cmp    $0x6,%edi
setge  %cl
xor    $0x3,%ecx
test   %edi,%edi
mov    $0x1,%eax
cmovg  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp slt i32 %0, 1
%3 = icmp sgt i32 %0, 5
%4 = select i1 %3, i32 2, i32 3
%5 = select i1 %2, i32 1, i32 %4
ret i32 %5
}
void XESetErrorString() {}


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

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

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

LLVM IR (-O2):
define void @XESetErrorString() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int putc(int, int /*<<< orphan*/ *);
int putchar(int);
int meputc(int c, FILE *fdev) {
  return fdev != NULL ? putc(c, fdev) : putchar(c);
}


x86 assembly (clang, -O0):
<meputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114e <meputc+0x2e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <putc@plt>
mov    %eax,-0x14(%rbp)
jmp    1159 <meputc+0x39>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meputc>:
test   %rsi,%rsi
je     112a <meputc+0xa>
jmp    1040 <putc@plt>
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define i32 @meputc(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32*, i32** %4
%10 = call i32 @putc(i32 %8, i32* %9)
br label %14
11: ; preds = %2
%12 = load i32, i32* %3
%13 = call i32 @putchar(i32 %12)
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ %10, %7 ], [ %13, %11 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @meputc(i32 %0, i32* %1) {
%3 = icmp eq i32* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @putc(i32 %0, i32* %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @putchar(i32 %0)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ output_with_tab(char *);
void gen_immediate2(void) { output_with_tab("lxi \td,"); }


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

x86 assembly (clang, -O2):
<gen_immediate2>:
lea    0xee9(%rip),%rdi
jmp    1030 <output_with_tab@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"lxi \09d,\00"
define void @gen_immediate2() {
%1 = call i32 @output_with_tab(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"lxi \09d,\00"
define void @gen_immediate2() {
%1 = tail call i32 @output_with_tab(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
char is_type_j(int inst) { return ((inst & 0xFC000000) >> 25) == 1; }


x86 assembly (clang, -O0):
<is_type_j>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfc000000,%eax
shr    $0x19,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @is_type_j(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -67108864
%5 = lshr i32 %4, 25
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @is_type_j(i32 %0) {
ret i8 0
}
void resolve_pct_format(double *value, const char **format) {
  *value *= 100;
  *format = "%7.3f%%";
}


x86 assembly (clang, -O0):
<resolve_pct_format>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xee8(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolve_pct_format>:
movsd  (%rdi),%xmm0
mulsd  0xef4(%rip),%xmm0
movsd  %xmm0,(%rdi)
lea    0xef1(%rip),%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%7.3f%%\00"
define void @resolve_pct_format(double* %0, i8** %1) {
%3 = alloca double*
%4 = alloca i8**
store double* %0, double** %3
store i8** %1, i8*** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = fmul double %6, 1.000000e+02
store double %7, double* %5
%8 = load i8**, i8*** %4
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %8
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%7.3f%%\00"
define void @resolve_pct_format(double* nocapture %0, i8** nocapture writeonly %1) {
%3 = load double, double* %0
%4 = fmul double %3, 1.000000e+02
store double %4, double* %0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ discardnewline(char *);
scalar_t__ getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main(void) {
  char line[1024];
  while (getline(line, sizeof line) > 0) {
    discardnewline(line);
    reverse(line);
    printf("%s\n", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <getline@plt>
cmp    $0x0,%rax
jle    119d <main+0x5d>
lea    -0x410(%rbp),%rdi
call   1060 <discardnewline@plt>
lea    -0x410(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x410(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rdi
mov    $0x400,%esi
call   1050 <getline@plt>
test   %rax,%rax
jle    119d <main+0x5d>
mov    %rsp,%rbx
lea    0xe9a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <discardnewline@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <getline@plt>
test   %rax,%rax
jg     1170 <main+0x30>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i64 @getline(i8* %4, i32 1024)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%9 = call i32 @discardnewline(i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = call i32 @reverse(i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %3
14: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i64 @getline(i8* %2, i32 1024)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0, %5
%6 = call i32 @discardnewline(i8* %2)
%7 = call i32 @reverse(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i64 @getline(i8* %2, i32 1024)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %0
ret i32 0
}