xunge/DecIR huggingface dataset:
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  long long tv_sec;
  long long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
long long tod(void) {
  struct timeval t;
  gettimeofday(&t, (struct timezone *)0);
  return t.tv_sec * (long long)1000000 + t.tv_usec;
}


x86 assembly (clang, -O0):
<tod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%rax
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tod>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x8(%rsp),%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define i64 @tod() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = mul nsw i64 %4, 1000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i64, i64* %6
%8 = add nsw i64 %5, %7
ret i64 %8
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define i64 @tod() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}
/* Variables and functions */
unsigned char toupper(unsigned char);
char *strupr(char *str) {
  unsigned char *p = (unsigned char *)str;
  while (*p) {
    *p = toupper(*p);
    p++;
  }
  return str;
}


x86 assembly (clang, -O0):
<strupr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <strupr+0x46>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <strupr+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strupr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <strupr+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strupr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strupr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call zeroext i8 @toupper(i8 zeroext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int __builtin_strncmp(char const *, char const *, size_t);
int strncmp(char const *lhs, char const *rhs, size_t cnt) {
  return __builtin_strncmp(lhs, rhs, cnt);
}


x86 assembly (clang, -O0):
<strncmp>:
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),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @strncmp(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @strncmp(i8* %7, i8* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @strncmp(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
br label %4
4: ; preds = %4, %3
br label %4
}
/* Variables and functions */
int get_int_at_field(char *, int);
int get_score(char *line) { return get_int_at_field(line, 3); }


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

x86 assembly (clang, -O2):
<get_score>:
mov    $0x3,%esi
jmp    1030 <get_int_at_field@plt>

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

LLVM IR (-O2):
define i32 @get_score(i8* %0) {
%2 = tail call i32 @get_int_at_field(i8* %0, i32 3)
ret i32 %2
}
/* Variables and functions */
double sum(int const *, int const);
double mean(const int *args, const int size) {
  double s = sum(args, size);
  double mean = s / size;
  return mean;
}


x86 assembly (clang, -O0):
<mean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <sum@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mean>:
push   %rbx
mov    %esi,%ebx
call   1030 <sum@plt>
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @mean(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = call double @sum(i32* %7, i32 %8)
store double %9, double* %5
%10 = load double, double* %5
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fdiv double %10, %12
store double %13, double* %6
%14 = load double, double* %6
ret double %14
}

LLVM IR (-O2):
define double @mean(i32* %0, i32 %1) {
%3 = tail call double @sum(i32* %0, i32 %1)
%4 = sitofp i32 %1 to double
%5 = fdiv double %3, %4
ret double %5
}
/* Variables and functions */
int cube(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n;
  printf("请输入一个整数: ");
  scanf("%d", &n);
  printf("%d的立方是: %d\n", n, cube(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <cube@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1050 <cube@plt>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E6\95\B4\E6\95\B0: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"%d\E7\9A\84\E7\AB\8B\E6\96\B9\E6\98\AF: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @cube(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E6\95\B4\E6\95\B0: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"%d\E7\9A\84\E7\AB\8B\E6\96\B9\E6\98\AF: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @cube(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int udClose(int gate_fd) { close(gate_fd); }


x86 assembly (clang, -O0):
<udClose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udClose>:
jmp    1030 <close@plt>

LLVM IR (-O0):
define i32 @udClose(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @close(i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @udClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 undef
}
void SpdWorkgroupShuffleBarrier() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ MSG_NOSIGNAL;
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
ssize_t send_tcp_client_data(int sock, char *send_data, int len) {
  return send(sock, send_data, len, MSG_NOSIGNAL);
}


x86 assembly (clang, -O0):
<send_tcp_client_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
call   1030 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_tcp_client_data>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <send@plt>

LLVM IR (-O0):
@MSG_NOSIGNAL = global i32 0
define i32 @send_tcp_client_data(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i32, i32* @MSG_NOSIGNAL
%11 = call i32 @send(i32 %7, i8* %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@MSG_NOSIGNAL = global i32 0
define i32 @send_tcp_client_data(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @MSG_NOSIGNAL
%5 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 %4)
ret i32 %5
}
void v9fs_cache_inode_put_cookie(struct inode *inode) {}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
define void @v9fs_cache_inode_put_cookie(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
ret void
}

LLVM IR (-O2):
%struct.inode = type opaque
define void @v9fs_cache_inode_put_cookie(%struct.inode* nocapture %0) {
ret void
}
__attribute__((no_icf)) _Bool f3(char *s) {
  return s != __builtin_strstr(s, "hello");
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
define zeroext i1 @f3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strstr(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i8* %3, %5
ret i1 %6
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define zeroext i1 @f3(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5)
%3 = icmp ne i32 %2, 0
ret i1 %3
}
int test_imm_80int8_mem(signed char *val) {
  return ((*val) & (0x80 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_80int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x80,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_80int8_mem>:
cmpb   $0x0,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_80int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 128
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_80int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp sgt i8 %2, -1
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char label[] = "Single";
  printf("label: [%s] \n", label);
  printf("label: [%c] \n", label[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xb(%rbp),%rsi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x9(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x656c67,0x3(%rsp)
movl   $0x676e6953,(%rsp)
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x2(%rsp),%esi
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.label = [7 x i8] c"Single\00"
@.str = [14 x i8] c"label: [%s] \0A\00"
@.str.1 = [14 x i8] c"label: [%c] \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
store i32 0, i32* %1
%3 = bitcast [7 x i8]* %2 to i8*
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.label = [7 x i8] c"Single\00"
@.str = [14 x i8] c"label: [%s] \0A\00"
@.str.1 = [14 x i8] c"label: [%c] \0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
int fd_control_ffs(int mask) {
  if (mask == 0) {
    return 0;
  }
  int bit;
  for (bit = 0; !(mask & 1); bit++) {
    mask >>= 1;
  }
  return bit;
}


x86 assembly (clang, -O0):
<fd_control_ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <fd_control_ffs+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    115c <fd_control_ffs+0x5c>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113f <fd_control_ffs+0x3f>
jmp    1156 <fd_control_ffs+0x56>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <fd_control_ffs+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_control_ffs>:
xor    %eax,%eax
test   %edi,%edi
je     112d <fd_control_ffs+0x2d>
mov    %edi,%ecx
and    $0x1,%ecx
jne    112d <fd_control_ffs+0x2d>
xor    %eax,%eax
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
sar    %ecx
add    $0x1,%eax
test   $0x2,%dil
mov    %ecx,%edi
je     1120 <fd_control_ffs+0x20>
ret

LLVM IR (-O0):
define i32 @fd_control_ffs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %22
8: ; preds = %1
store i32 0, i32* %4
br label %9
9: ; preds = %17, %8
%10 = load i32, i32* %3
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i32, i32* %3
%16 = ashr i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %9
20: ; preds = %9
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %22
22: ; preds = %20, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @fd_control_ffs(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = and i32 %0, 1
%4 = icmp eq i32 %3, 0
%5 = and i1 %2, %4
br i1 %5, label %6, label %13
6: ; preds = %1, %6
%7 = phi i32 [ %10, %6 ], [ 0, %1 ]
%8 = phi i32 [ %9, %6 ], [ %0, %1 ]
%9 = ashr i32 %8, 1
%10 = add nuw nsw i32 %7, 1
%11 = and i32 %8, 2
%12 = icmp eq i32 %11, 0
br i1 %12, label %6, label %13
13: ; preds = %6, %1
%14 = phi i32 [ 0, %1 ], [ %10, %6 ]
ret i32 %14
}
void outc(c) register char c;
{ putchar(c); }


x86 assembly (clang, -O0):
<outc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
mov    $0x0,%al
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outc>:
movsbl %dil,%edi
xor    %eax,%eax
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @outc(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void SPI5_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @SPI5_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @SPI5_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
const char *macos() { return "macos"; }


x86 assembly (clang, -O0):
<macos>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<macos>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"macos\00"
define i8* @macos() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"macos\00"
define i8* @macos() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int restore_weight(signed char weight) {
  int result;
  if ((result = (int)weight * 8) > 0)
    result += (result + 64) >> 7;
  return result;
}


x86 assembly (clang, -O0):
<restore_weight>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    112c <restore_weight+0x2c>
mov    -0x8(%rbp),%eax
add    $0x40,%eax
sar    $0x7,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<restore_weight>:
lea    0x40(,%rdi,8),%eax
sar    $0x7,%eax
xor    %ecx,%ecx
test   %dil,%dil
cmovg  %eax,%ecx
lea    (%rcx,%rdi,8),%eax
ret

LLVM IR (-O0):
define i32 @restore_weight(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = mul nsw i32 %5, 8
store i32 %6, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 64
%11 = ashr i32 %10, 7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, %11
store i32 %13, i32* %3
br label %14
14: ; preds = %8, %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @restore_weight(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = shl nsw i32 %2, 3
%4 = icmp sgt i8 %0, 0
%5 = add nsw i32 %3, 64
%6 = ashr i32 %5, 7
%7 = select i1 %4, i32 %6, i32 0
%8 = add nsw i32 %7, %3
ret i32 %8
}
void SysCtlIntEnable(unsigned long ulIntFlags) {

  ;
  (*((volatile unsigned long *)(0x40021008))) |= (ulIntFlags << 8);
}


x86 assembly (clang, -O0):
<SysCtlIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x8,%rax
mov    $0x40021008,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x40021008,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlIntEnable>:
shl    $0x8,%rdi
or     %rdi,0x40021008
40
ret

LLVM IR (-O0):
define void @SysCtlIntEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 8
%5 = load volatile i64, i64* inttoptr (i64 1073877000 to i64*)
%6 = or i64 %5, %4
store volatile i64 %6, i64* inttoptr (i64 1073877000 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlIntEnable(i64 %0) {
%2 = shl i64 %0, 8
%3 = load volatile i64, i64* inttoptr (i64 1073877000 to i64*)
%4 = or i64 %3, %2
store volatile i64 %4, i64* inttoptr (i64 1073877000 to i64*)
ret void
}
double machine_eps() {
  double eps = 1.;
  do {
    eps /= 2.;
  } while (1. + eps / 2. > 1.);
  return eps;
}


x86 assembly (clang, -O0):
<machine_eps>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xed4(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xec0(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1111 <machine_eps+0x11>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<machine_eps>:
movsd  0xef8(%rip),%xmm1
movsd  0xef8(%rip),%xmm2
movapd %xmm1,%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm0,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
ucomisd %xmm1,%xmm3
ja     1120 <machine_eps+0x20>
ret

LLVM IR (-O0):
define double @machine_eps() {
%1 = alloca double
store double 1.000000e+00, double* %1
br label %2
2: ; preds = %5, %0
%3 = load double, double* %1
%4 = fdiv double %3, 2.000000e+00
store double %4, double* %1
br label %5
5: ; preds = %2
%6 = load double, double* %1
%7 = fdiv double %6, 2.000000e+00
%8 = fadd double 1.000000e+00, %7
%9 = fcmp ogt double %8, 1.000000e+00
br i1 %9, label %2, label %10
10: ; preds = %5
%11 = load double, double* %1
ret double %11
}

LLVM IR (-O2):
define double @machine_eps() {
br label %1
1: ; preds = %1, %0
%2 = phi double [ 1.000000e+00, %0 ], [ %6, %1 ]
%3 = fmul double %2, 5.000000e-01
%4 = fmul double %3, 5.000000e-01
%5 = fmul double %4, 5.000000e-01
%6 = fmul double %5, 5.000000e-01
%7 = fmul double %6, 5.000000e-01
%8 = fadd double %7, 1.000000e+00
%9 = fcmp ogt double %8, 1.000000e+00
br i1 %9, label %1, label %10
10: ; preds = %1
ret double %6
}
void RGB24ToARGBRow_NEON() {}


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

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

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

LLVM IR (-O2):
define void @RGB24ToARGBRow_NEON() {
ret void
}
int f(long long a, long long b) { return a > 5; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x5,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
cmp    $0x6,%rdi
setge  %al
ret

LLVM IR (-O0):
define i32 @f(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp sgt i64 %5, 5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, 5
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ modff(float, float *);
float floorf(float x) {
  modff(x, &x);
  if (x < 0.0) {
    x -= 1.0;
  }
  return x;
}


x86 assembly (clang, -O0):
<floorf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
lea    -0x4(%rbp),%rdi
call   1030 <modff@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    115f <floorf+0x4f>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeae(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floorf>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <modff@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    113d <floorf+0x2d>
addss  0xec9(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
pop    %rax
ret

LLVM IR (-O0):
define float @floorf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @modff(float %3, float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = fsub double %10, 1.000000e+00
%12 = fptrunc double %11 to float
store float %12, float* %2
br label %13
13: ; preds = %8, %1
%14 = load float, float* %2
ret float %14
}

LLVM IR (-O2):
define float @floorf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call i32 @modff(float %0, float* %2)
%4 = load float, float* %2
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = fadd float %4, -1.000000e+00
store float %7, float* %2
br label %8
8: ; preds = %6, %1
%9 = phi float [ %7, %6 ], [ %4, %1 ]
ret float %9
}
int main() {
  float f;
  int i;
  asm("fld %1\nfistpl %0\n" : "=m"(*&i) : "f"(f));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
flds   -0x10(%rbp)
fld    %st(0)
fistpl -0xc(%rbp)
fstp   %st(0)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
fldz
fld    %st(0)
fistpl -0x4(%rsp)
fstp   %st(0)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
%4 = load float, float* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
ret i32 0
}
/* Variables and functions */
int ncmp(char const *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int cmp(const char *s1, const char *s2) { return ncmp(s1, s2, strlen(s2)); }


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <ncmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ncmp@plt>

LLVM IR (-O0):
define i32 @cmp(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @ncmp(i8* %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @cmp(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @ncmp(i8* %0, i8* %1, i32 %3)
ret i32 %4
}
int __fls(int x) {
  int r;
  __asm__("bsrl %1,%0\n\t"
          "cmovz %2,%0"
          : "=&r"(r)
          : "rm"(x), "rm"(-1));
  return r + 1;
}


x86 assembly (clang, -O0):
<__fls>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
bsr    -0xc(%rbp),%eax
cmove  0xee8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fls>:
mov    %edi,-0x4(%rsp)
bsr    -0x4(%rsp),%eax
cmove  0xef0(%rip),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @__fls(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm "bsrl $1,$0\0A\09cmovz $2,$0", "=&r,rm,rm,~{dirflag},~{fpsr},~{flags}"(i32 %4, i32 -1)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @__fls(i32 %0) {
%2 = tail call i32 asm "bsrl $1,$0\0A\09cmovz $2,$0", "=&r,rm,rm,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 -1)
%3 = add nsw i32 %2, 1
ret i32 %3
}
int exact_square(int n) {
  int i;
  for (i = 0; i <= n; i++) {
    if (n == i * i) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     114b <exact_square+0x4b>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    1138 <exact_square+0x38>
movl   $0x1,-0x4(%rbp)
jmp    1152 <exact_square+0x52>
jmp    113d <exact_square+0x3d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <exact_square+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
test   %edi,%edi
js     1120 <exact_square+0x20>
lea    0x1(%rdi),%eax
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    %ecx,%edx
imul   %ecx,%edx
cmp    %edi,%edx
je     1123 <exact_square+0x23>
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1110 <exact_square+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %10, label %6
3: ; preds = %6
%4 = add nuw i32 %7, 1
%5 = icmp eq i32 %7, %0
br i1 %5, label %10, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 0, %1 ]
%8 = mul nsw i32 %7, %7
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %6, %3, %1
%11 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %6 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int readword(FILE *fp) {
  unsigned char buf[2];
  unsigned int w;
  int retval;
  retval = fread(buf, 1, 2, fp);
  if (retval == 0)
    return -1;
  w = buf[1] | buf[0] << 8;
  return w;
}


x86 assembly (clang, -O0):
<readword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    114c <readword+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <readword+0x52>
movzbl -0x11(%rbp),%eax
movzbl -0x12(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readword>:
push   %rax
mov    %rdi,%rcx
lea    0x6(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
movzwl 0x6(%rsp),%ecx
shl    $0x10,%ecx
bswap  %ecx
cmp    $0x1,%eax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @readword(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [2 x i8]
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%8 = load i32*, i32** %3
%9 = call i32 @fread(i8* %7, i32 1, i32 2, i32* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %23
13: ; preds = %1
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = or i32 %16, %20
store i32 %21, i32* %5
%22 = load i32, i32* %5
store i32 %22, i32* %2
br label %23
23: ; preds = %13, %12
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @readword(i32* nocapture %0) {
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = call i32 @fread(i8* %3, i32 1, i32 2, i32* %0)
%5 = icmp eq i32 %4, 0
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl nuw nsw i32 %10, 8
%12 = or i32 %11, %8
%13 = select i1 %5, i32 -1, i32 %12
ret i32 %13
}
unsigned int normalize(unsigned int a, unsigned int size) { return a % size; }


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

x86 assembly (clang, -O2):
<normalize>:
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @normalize(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 = load i32, i32* %4
%7 = urem i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @normalize(i32 %0, i32 %1) {
%3 = urem i32 %0, %1
ret i32 %3
}
void RTStrPrintfV(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrPrintfV() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ avl();
int /*<<< orphan*/ hash();
int /*<<< orphan*/ list();
int /*<<< orphan*/ rb();
int main() {
  rb();
  avl();
  list();
  hash();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <rb@plt>
mov    $0x0,%al
call   1040 <avl@plt>
mov    $0x0,%al
call   1050 <list@plt>
mov    $0x0,%al
call   1030 <hash@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <rb@plt>
xor    %eax,%eax
call   1040 <avl@plt>
xor    %eax,%eax
call   1050 <list@plt>
xor    %eax,%eax
call   1030 <hash@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @rb()
%2 = call i32 (...) @avl()
%3 = call i32 (...) @list()
%4 = call i32 (...) @hash()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rb()
%2 = tail call i32 (...) @avl()
%3 = tail call i32 (...) @list()
%4 = tail call i32 (...) @hash()
ret i32 0
}
float min(float a, float b) { return (a <= b ? a : b); }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1130 <min+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <min+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
movaps %xmm0,%xmm2
cmpless %xmm1,%xmm2
andps  %xmm2,%xmm0
andnps %xmm1,%xmm2
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @min(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ole float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @min(float %0, float %1) {
%3 = fcmp ole float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ getStringFromConsole(char const *, char *, int);
char getFirstCharFromConsole(const char *consoleStr) {
  char ret = 0;
  if (consoleStr != NULL) {
    getStringFromConsole(consoleStr, &ret, 1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<getFirstCharFromConsole>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113d <getFirstCharFromConsole+0x2d>
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <getStringFromConsole@plt>
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFirstCharFromConsole>:
push   %rax
movb   $0x0,0x7(%rsp)
test   %rdi,%rdi
je     1130 <getFirstCharFromConsole+0x20>
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <getStringFromConsole@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @getFirstCharFromConsole(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @getStringFromConsole(i8* %7, i8* %3, i32 1)
br label %9
9: ; preds = %6, %1
%10 = load i8, i8* %3
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @getFirstCharFromConsole(i8* %0) {
%2 = alloca i8
store i8 0, i8* %2
%3 = icmp eq i8* %0, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = call i32 @getStringFromConsole(i8* %0, i8* %2, i32 1)
%6 = load i8, i8* %2
br label %7
7: ; preds = %4, %1
%8 = phi i8 [ %6, %4 ], [ 0, %1 ]
ret i8 %8
}
/* Variables and functions */
float fahrenheitFromCelcius(float);
int /*<<< orphan*/ printf(char *, float);
int main(int argc, const char *argv[]) {
  float freezeInC = 0;
  float freezeInF = fahrenheitFromCelcius(freezeInC);
  printf("Water freezes at %f degrees Fahrenheit.\n", freezeInF);
  return 0;
}


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)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <fahrenheitFromCelcius@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xorps  %xmm0,%xmm0
call   1040 <fahrenheitFromCelcius@plt>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Water freezes at %f degrees Fahrenheit.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0.000000e+00, float* %6
%8 = load float, float* %6
%9 = call float @fahrenheitFromCelcius(float %8)
store float %9, float* %7
%10 = load float, float* %7
%11 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Water freezes at %f degrees Fahrenheit.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call float @fahrenheitFromCelcius(float 0.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), float %3)
ret i32 0
}
void WATCHDOG_COUNTER_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @WATCHDOG_COUNTER_SaveConfig() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void caml_gr_point_color() { exit(1); }


x86 assembly (clang, -O0):
<caml_gr_point_color>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<caml_gr_point_color>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @caml_gr_point_color() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @caml_gr_point_color() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
int cmp(const void *a, const void *b) { return (*(char *)a - *(char *)b); }


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
scalar_t__ fail(char *, size_t);
void *malloc(size_t);
void *safemalloc(size_t nbytes) {
  void *m = malloc(nbytes);
  m != NULL || fail("Allocation failure: %d", nbytes);
  return m;
}


x86 assembly (clang, -O0):
<safemalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jne    1163 <safemalloc+0x43>
mov    -0x8(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1030 <fail@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safemalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <safemalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <fail@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Allocation failure: %d\00"
define i8* @safemalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i64 @fail(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %8, %1
%13 = phi i1 [ true, %1 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [23 x i8] c"Allocation failure: %d\00"
define noalias i8* @safemalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i64 @fail(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_message_skip(void *m, const char *types) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_message_skip>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecb(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_message_skip>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_message_skip(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_message_skip(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}