xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ member_0;
};
struct ether_addr {
  TYPE_1__ member_0;
};

/* Variables and functions */
scalar_t__ memcmp(struct ether_addr const *, struct ether_addr const *, int);
bool mac_isempty(const struct ether_addr *ea) {
  static const struct ether_addr empty = {{0}};
  return memcmp(ea, &empty, sizeof empty) == 0;
}


x86 assembly (clang, -O0):
<mac_isempty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mac_isempty>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.ether_addr = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@mac_isempty.empty = internal constant %struct.ether_addr zeroinitializer
define i32 @mac_isempty(%struct.ether_addr* %0) {
%2 = alloca %struct.ether_addr*
store %struct.ether_addr* %0, %struct.ether_addr** %2
%3 = load %struct.ether_addr*, %struct.ether_addr** %2
%4 = call i64 @memcmp(%struct.ether_addr* %3, %struct.ether_addr* @mac_isempty.empty, i32 4)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
%struct.ether_addr = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@mac_isempty.empty = internal constant %struct.ether_addr zeroinitializer
define i32 @mac_isempty(%struct.ether_addr* %0) {
%2 = tail call i64 @memcmp(%struct.ether_addr* %0, %struct.ether_addr* @mac_isempty.empty, i32 4)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void _libgloss_cio_hook(void) {
  __asm__ __volatile__(" .global C$$IO$$");
  __asm__ __volatile__("C$$IO$$: nop");
}


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

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

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

LLVM IR (-O2):
define void @_libgloss_cio_hook() {
tail call void asm sideeffect " .global C$$$$IO$$$$", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "C$$$$IO$$$$: nop", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ badshift(int);
int main() {
  if (badshift(1) == 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <badshift@plt>
cmp    $0x0,%rax
jne    114a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <badshift@plt>
test   %rax,%rax
je     1134 <main+0x14>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @badshift(i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @badshift(i32 1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void playgame() {
  char *begin =
      "You wake up to the sound of the doorbell ringing incessantly.\n";
  printf("%s", begin);
}


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

x86 assembly (clang, -O2):
<playgame>:
lea    0xf28(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"You wake up to the sound of the doorbell ringing incessantly.\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @playgame() {
%1 = alloca i8*
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"You wake up to the sound of the doorbell ringing incessantly.\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @playgame() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
ret void
}
void w55fa93fb_init_pwm_device(void) {}


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

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

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

LLVM IR (-O2):
define void @w55fa93fb_init_pwm_device() {
ret void
}
void SPI_SD_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @SPI_SD_RestoreConfig() {
ret void
}
void DoNotOptimize(void *value) {
  __asm__ volatile("" : : "r,m"(value) : "memory");
}


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

x86 assembly (clang, -O2):
<DoNotOptimize>:
mov    %rdi,-0x8(%rsp)
ret

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

LLVM IR (-O2):
define void @DoNotOptimize(i8* %0) {
tail call void asm sideeffect "", "r|m,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char);
int main() {
  char a = 291;
  printf("\n%d %c\n", a, a);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"\0A%d %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 35, i8* %2
%3 = load i8, i8* %2
%4 = load i8, i8* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %3, i8 signext %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0A%d %c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext 35, i8 signext 35)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ft_strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
void ft_putstr(char const *s) { write(1, s, ft_strlen(s)); }


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @ft_putstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @ft_strlen(i8* %4)
%6 = call i32 @write(i32 1, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @ft_putstr(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0xe5() {
  Assert_real((ispunct(229) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              1150, ("ispunct should be 0 for 0xe5"));
}


x86 assembly (clang, -O0):
<t_ispunct_0xe5>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe5,%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x47e,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0xe5>:
push   %rax
mov    $0xe5,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x47e,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xe5\00"
define void @t_ispunct_0xe5() {
%1 = call i64 @ispunct(i32 229)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1150, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xe5\00"
define void @t_ispunct_0xe5() {
%1 = tail call i64 @ispunct(i32 229)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1150, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int string_ln(char *p) {
  int count = 0;
  while (*p != '\0') {
    count++;
    p++;
  }
  return count;
}


x86 assembly (clang, -O0):
<string_ln>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <string_ln+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <string_ln+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_ln>:
cmpb   $0x0,(%rdi)
je     111c <string_ln+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <string_ln+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @string_ln(i8* nocapture %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 i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%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
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
extern unsigned int inw(unsigned long addr) {
  long result =
      *(volatile int *)((addr << 5) + ((0xfffffc0000000000UL) + 0x1c0000000UL) +
                        0x08);
  result >>= (addr & 3) * 8;
  return 0xffffUL & result;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x5,%rax
movabs $0xfffffc01c0000000,%rcx
fc ff ff
add    %rcx,%rax
mov    0x8(%rax),%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
and    $0x3,%rcx
shl    $0x3,%rcx
mov    -0x10(%rbp),%rax
sar    %cl,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
lea    0x0(,%rdi,8),%ecx
shl    $0x5,%rdi
movabs $0xfffffc01c0000008,%rax
fc ff ff
movslq (%rdi,%rax,1),%rax
and    $0x18,%cl
sar    %cl,%rax
movzwl %ax,%eax
ret

LLVM IR (-O0):
define i32 @inw(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = shl i64 %4, 5
%6 = add i64 %5, -4390530318336
%7 = add i64 %6, 8
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = sext i32 %9 to i64
store i64 %10, i64* %3
%11 = load i64, i64* %2
%12 = and i64 %11, 3
%13 = mul i64 %12, 8
%14 = load i64, i64* %3
%15 = ashr i64 %14, %13
store i64 %15, i64* %3
%16 = load i64, i64* %3
%17 = and i64 65535, %16
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @inw(i64 %0) {
%2 = shl i64 %0, 5
%3 = add i64 %2, -4390530318328
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = sext i32 %5 to i64
%7 = shl i64 %0, 3
%8 = and i64 %7, 24
%9 = ashr i64 %6, %8
%10 = trunc i64 %9 to i32
%11 = and i32 %10, 65535
ret i32 %11
}
int test_imm_D2int64_lowword_reg(long long val) {
  return ((val) & (0xD2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D2int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xd2,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D2int64_lowword_reg>:
test   $0xd2,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D2int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 210
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_int(int a) { printf("%d\n", a); }


x86 assembly (clang, -O0):
<print_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @print_int(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ jul2greg(double, int *, int *, int *, int *, int *,
                            double *);
int julian_get_month_number(double current) {
  int year, month, day, hour, minute;
  double seconds;
  jul2greg(current, &month, &day, &year, &hour, &minute, &seconds);
  return month;
}


x86 assembly (clang, -O0):
<julian_get_month_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1030 <jul2greg@plt>
mov    -0x10(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<julian_get_month_number>:
sub    $0x28,%rsp
lea    0xc(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x20(%rsp),%r9
call   1030 <jul2greg@plt>
mov    0xc(%rsp),%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @julian_get_month_number(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store double %0, double* %2
%9 = load double, double* %2
%10 = call i32 @jul2greg(double %9, i32* %4, i32* %5, i32* %3, i32* %6, i32* %7, double* %8)
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
define i32 @julian_get_month_number(double %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = call i32 @jul2greg(double %0, i32* %3, i32* %4, i32* %2, i32* %5, i32* %6, double* %7)
%15 = load i32, i32* %3
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void progress(char *c, int i) {
  fputc('\r', stdout);
  fprintf(stdout, c, i);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<progress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <fprintf@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progress>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea0(%rip),%r14
mov    (%r14),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @progress(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdout
%6 = call i32 @fputc(i8 signext 13, i32 %5)
%7 = load i32, i32* @stdout
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @fprintf(i32 %7, i8* %8, i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @progress(i8* %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputc(i8 signext 13, i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* %0, i32 %1)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ init_dec();
int /*<<< orphan*/ test(int);
int main() {
  init();
  init_dec();
  test((1 << 8) / 2);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
mov    $0x0,%al
call   1030 <init_dec@plt>
mov    $0x80,%edi
call   1050 <test@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init@plt>
xor    %eax,%eax
call   1030 <init_dec@plt>
mov    $0x80,%edi
call   1050 <test@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @init()
%3 = call i32 (...) @init_dec()
%4 = call i32 @test(i32 128)
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = tail call i32 (...) @init_dec()
%3 = tail call i32 @test(i32 128)
ret i32 1
}
float CLAMP(float x, float min, float max) {
  if (x < min)
    return min;
  if (x > max)
    return max;
  return x;
}


x86 assembly (clang, -O0):
<CLAMP>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1135 <CLAMP+0x35>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <CLAMP+0x5d>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1153 <CLAMP+0x53>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <CLAMP+0x5d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CLAMP>:
minss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm3
andnps %xmm2,%xmm3
andps  %xmm1,%xmm0
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @CLAMP(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %5
%9 = load float, float* %6
%10 = fcmp olt float %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load float, float* %6
store float %12, float* %4
br label %21
13: ; preds = %3
%14 = load float, float* %5
%15 = load float, float* %7
%16 = fcmp ogt float %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load float, float* %7
store float %18, float* %4
br label %21
19: ; preds = %13
%20 = load float, float* %5
store float %20, float* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load float, float* %4
ret float %22
}

LLVM IR (-O2):
define float @CLAMP(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = select i1 %5, float %2, float %0
%7 = select i1 %4, float %1, float %6
ret float %7
}
signed int f11(signed int v_foo) {
  signed int v_shr = v_foo << 2;
  signed int v_and = v_shr & -241;
  return v_and;
}


x86 assembly (clang, -O0):
<f11>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffffff0f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f11>:
and    $0xffffffc3,%edi
lea    0x0(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @f11(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = shl i32 %5, 2
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = and i32 %7, -241
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @f11(i32 %0) {
%2 = shl i32 %0, 2
%3 = and i32 %2, -244
ret i32 %3
}
int sc(int n) { return n * 65535 / 255; }


x86 assembly (clang, -O0):
<sc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0xffff,-0x4(%rbp),%eax
mov    $0xff,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc>:
mov    %edi,%eax
shl    $0x8,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @sc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 65535
%5 = sdiv i32 %4, 255
ret i32 %5
}

LLVM IR (-O2):
define i32 @sc(i32 %0) {
%2 = mul nsw i32 %0, 257
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ daemonize();
int /*<<< orphan*/ enable_syslog();
int /*<<< orphan*/ open_log();
int /*<<< orphan*/ read_config();
int /*<<< orphan*/ sockify();
int main(void) {
  enable_syslog();
  read_config();
  open_log();
  daemonize();
  sockify();
  closelog();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <enable_syslog@plt>
mov    $0x0,%al
call   1070 <read_config@plt>
mov    $0x0,%al
call   1050 <open_log@plt>
mov    $0x0,%al
call   1040 <daemonize@plt>
mov    $0x0,%al
call   1060 <sockify@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <enable_syslog@plt>
xor    %eax,%eax
call   1070 <read_config@plt>
xor    %eax,%eax
call   1050 <open_log@plt>
xor    %eax,%eax
call   1040 <daemonize@plt>
xor    %eax,%eax
call   1060 <sockify@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @enable_syslog()
%3 = call i32 (...) @read_config()
%4 = call i32 (...) @open_log()
%5 = call i32 (...) @daemonize()
%6 = call i32 (...) @sockify()
%7 = call i32 (...) @closelog()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @enable_syslog()
%2 = tail call i32 (...) @read_config()
%3 = tail call i32 (...) @open_log()
%4 = tail call i32 (...) @daemonize()
%5 = tail call i32 (...) @sockify()
%6 = tail call i32 (...) @closelog()
ret i32 0
}
/* Variables and functions */
int random();
int roll(int ndie, int nsides) {
  int tot;
  tot = 0;
  while (ndie--)
    tot += random() % nsides + 1;
  return tot;
}


x86 assembly (clang, -O0):
<roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1154 <roll+0x44>
mov    $0x0,%al
call   1030 <random@plt>
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <roll+0x15>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
je     1137 <roll+0x27>
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1030 <random@plt>
cltd
idiv   %r14d
add    %edx,%ebx
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1120 <roll+0x10>
jmp    1139 <roll+0x29>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @roll(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* %3
%8 = add nsw i32 %7, -1
store i32 %8, i32* %3
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = call i32 (...) @random()
%12 = load i32, i32* %4
%13 = srem i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %5
%16 = add nsw i32 %15, %14
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
define i32 @roll(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = add nsw i32 %6, -1
%8 = tail call i32 (...) @random()
%9 = srem i32 %8, %1
%10 = add i32 %5, 1
%11 = add i32 %10, %9
%12 = icmp eq i32 %7, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %14
}
__attribute__((weak)) void __early_init(void) {}


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

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

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

LLVM IR (-O2):
define weak void @__early_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int x;
  if (!(x < 0))
    return 0;
  while (x < 10) {
    x = x + 1;
  }
  assert(x == 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1135 <main+0x25>
movl   $0x0,-0x4(%rbp)
jmp    116a <main+0x5a>
jmp    113a <main+0x2a>
cmpl   $0xa,-0x8(%rbp)
jge    1152 <main+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <main+0x2a>
cmpl   $0xa,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t full_mod31_32(uint32_t a) {
  uint32_t t = ((0x84210842ULL * a) >> 36);
  uint8_t r = a + t - (t << 5);
  return r;
}


x86 assembly (clang, -O0):
<full_mod31_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x84210842,%rcx
imul   %rcx,%rax
shr    $0x24,%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x5,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<full_mod31_32>:
movslq %edi,%rax
mov    $0x84210842,%ecx
imul   %rax,%rcx
shr    $0x24,%rcx
add    %ecx,%eax
shl    $0x5,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @full_mod31_32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 2216757314, %6
%8 = lshr i64 %7, 36
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %3
%14 = shl i32 %13, 5
%15 = sub nsw i32 %12, %14
store i32 %15, i32* %4
%16 = load i32, i32* %4
ret i32 %16
}

LLVM IR (-O2):
define i32 @full_mod31_32(i32 %0) {
%2 = sext i32 %0 to i64
%3 = mul nsw i64 %2, 2216757314
%4 = lshr i64 %3, 36
%5 = trunc i64 %4 to i32
%6 = add nsw i32 %5, %0
%7 = mul i32 %5, -32
%8 = add i32 %6, %7
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
uint32_t pack_16b_16b(int32_t a, int32_t b) {}


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

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

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

LLVM IR (-O2):
define i32 @pack_16b_16b(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void pute(char *line) {
  fputs(line, stderr);
  fputs("\n", stderr);
}


x86 assembly (clang, -O0):
<pute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rdi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pute>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%esi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xed8(%rip),%rdi
pop    %rbx
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @pute(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = load i32, i32* @stderr
%7 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @pute(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("//no comment\""); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"//no comment\22\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"//no comment\22\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_bin(int);
int main(void) { print_bin(32); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
call   1030 <print_bin@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x20,%edi
call   1030 <print_bin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @print_bin(i32 32)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_bin(i32 32)
ret i32 0
}
int bytes_per_char_for_encoding(int encoding) {
  if (encoding == 1 || encoding == 2) {
    return 2;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<bytes_per_char_for_encoding>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     111b <bytes_per_char_for_encoding+0x1b>
cmpl   $0x2,-0x8(%rbp)
jne    1127 <bytes_per_char_for_encoding+0x27>
movl   $0x2,-0x4(%rbp)
jmp    112e <bytes_per_char_for_encoding+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_per_char_for_encoding>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
mov    $0x1,%eax
adc    $0x0,%eax
ret

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

LLVM IR (-O2):
define i32 @bytes_per_char_for_encoding(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 2
%4 = select i1 %3, i32 2, i32 1
ret i32 %4
}
/* Variables and functions */
char const *parse_quoted_string(char const *, char **);
char *parse_token(char const *, char **);
const char *parse_value(const char *value, char **pbuf) {
  const char *ret;
  if ((ret = parse_token(value, pbuf)))
    return ret;
  return parse_quoted_string(value, pbuf);
}


x86 assembly (clang, -O0):
<parse_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <parse_token@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1158 <parse_value+0x38>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <parse_value+0x49>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <parse_quoted_string@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_value>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <parse_token@plt>
test   %rax,%rax
je     113c <parse_value+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <parse_quoted_string@plt>

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

LLVM IR (-O2):
define i8* @parse_value(i8* %0, i8** %1) {
%3 = tail call i8* @parse_token(i8* %0, i8** %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8* @parse_quoted_string(i8* %0, i8** %1)
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %6, %5 ], [ %3, %2 ]
ret i8* %8
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int main() {
  struct sigaction act;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sigaction = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sigaction
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cup(int, int);
int /*<<< orphan*/ holdit();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rm(char *);
int /*<<< orphan*/ sm(char *);
bug_c() {
  sm("?3");
  cup(1, 81);
  rm("?3");
  cup(12, 5);
  printf("Except for this line, the screen should be blank. ");
  holdit();
}


x86 assembly (clang, -O0):
<bug_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1060 <sm@plt>
mov    $0x1,%edi
mov    $0x51,%esi
call   1050 <cup@plt>
lea    0xe86(%rip),%rdi
call   1030 <rm@plt>
mov    $0xc,%edi
mov    $0x5,%esi
call   1050 <cup@plt>
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <holdit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bug_c>:
push   %rbx
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
call   1060 <sm@plt>
mov    $0x1,%edi
mov    $0x51,%esi
call   1050 <cup@plt>
mov    %rbx,%rdi
call   1030 <rm@plt>
mov    $0xc,%edi
mov    $0x5,%esi
call   1050 <cup@plt>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1070 <holdit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"?3\00"
@.str.1 = [51 x i8] c"Except for this line, the screen should be blank. \00"
define i32 @bug_c() {
%1 = alloca i32
%2 = call i32 @sm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @cup(i32 1, i32 81)
%4 = call i32 @rm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @cup(i32 12, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @holdit()
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"?3\00"
@.str.1 = [51 x i8] c"Except for this line, the screen should be blank. \00"
define i32 @bug_c() {
%1 = tail call i32 @sm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @cup(i32 1, i32 81)
%3 = tail call i32 @rm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @cup(i32 12, i32 5)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @holdit()
ret i32 undef
}
/* Variables and functions */
int is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, c;
  scanf("%d", &n);
  c = is_prime(n);
  printf("%d", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9c(%rip),%rdi
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),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <is_prime@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @is_prime(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Type definitions */
struct stat {
  int st_size;
};
typedef int off_t;

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
off_t get_file_size(const char *filename) {
  struct stat buffer;
  return (stat(filename, &buffer) == 0 ? buffer.st_size : -1);
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    113e <get_file_size+0x2e>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114b <get_file_size+0x3b>
mov    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <get_file_size+0x3b>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
neg    %rax
sbb    %eax,%eax
or     (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @get_file_size(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 -1
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ AddYearToDate(char *, char *);
int /*<<< orphan*/ juliancal_to_suncal(char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void GetField37SunCal(char *field7, char *buf) {
  char curtime[15];
  memset(curtime, 0, 15);
  AddYearToDate(field7, curtime);
  juliancal_to_suncal(curtime, buf);
  return;
}


x86 assembly (clang, -O0):
<GetField37SunCal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1f(%rbp),%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1f(%rbp),%rsi
call   1050 <AddYearToDate@plt>
lea    -0x1f(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <juliancal_to_suncal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetField37SunCal>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x1(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <AddYearToDate@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <juliancal_to_suncal@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @GetField37SunCal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [15 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 15)
%8 = load i8*, i8** %3
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%10 = call i32 @AddYearToDate(i8* %8, i8* %9)
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @juliancal_to_suncal(i8* %11, i8* %12)
ret void
}

LLVM IR (-O2):
define void @GetField37SunCal(i8* %0, i8* %1) {
%3 = alloca [15 x i8]
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 15)
%6 = call i32 @AddYearToDate(i8* %0, i8* %4)
%7 = call i32 @juliancal_to_suncal(i8* %4, i8* %1)
ret void
}
/* Variables and functions */
double floor(double);
double saw(double phase) { return 2 * (phase - floor(phase + 0.5)); }


x86 assembly (clang, -O0):
<saw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed9(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
movsd  -0x10(%rbp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saw>:
push   %rax
movapd %xmm0,%xmm1
movsd  %xmm0,(%rsp)
movsd  0xede(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
addsd  %xmm1,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @saw(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 5.000000e-01
%6 = call double @llvm.floor.f64(double %5)
%7 = fsub double %3, %6
%8 = fmul double 2.000000e+00, %7
ret double %8
}

LLVM IR (-O2):
define double @saw(double %0) {
%2 = fadd double %0, 5.000000e-01
%3 = tail call double @llvm.floor.f64(double %2)
%4 = fsub double %0, %3
%5 = fmul double %4, 2.000000e+00
ret double %5
}
void flush_cl(void *addr) { asm volatile("clflush (%0)" ::"r"(addr)); }


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

x86 assembly (clang, -O2):
<flush_cl>:
clflush (%rdi)
ret

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

LLVM IR (-O2):
define void @flush_cl(i8* %0) {
tail call void asm sideeffect "clflush ($0)", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}