xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void random_init() {
  static bool done = false;
  if (done)
    return;
  srandom(time(NULL));
  done = true;
}


x86 assembly (clang, -O0):
<random_init>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f09(%rip)
je     1136 <random_init+0x16>
jmp    1150 <random_init+0x30>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
movl   $0x1,0x2ee4(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_init>:
push   %rax
cmpb   $0x0,0x2f0c(%rip)
jne    113f <random_init+0x1f>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
movb   $0x1,0x2ef5(%rip)
pop    %rax
ret

LLVM IR (-O0):
@random_init.done = internal global i32 0
define void @random_init() {
%1 = load i32, i32* @random_init.done
%2 = icmp ne i32 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %0
br label %7
4: ; preds = %0
%5 = call i32 @time(i32* null)
%6 = call i32 @srandom(i32 %5)
store i32 1, i32* @random_init.done
br label %7
7: ; preds = %4, %3
ret void
}

LLVM IR (-O2):
@random_init.done = internal unnamed_addr global i1 false
define void @random_init() {
%1 = load i1, i1* @random_init.done
br i1 %1, label %5, label %2
2: ; preds = %0
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srandom(i32 %3)
store i1 true, i1* @random_init.done
br label %5
5: ; preds = %0, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_BIT_STRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_BIT_STRING_it;
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a) {
  ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it);
}


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

x86 assembly (clang, -O2):
<ASN1_BIT_STRING_free>:
mov    0x2ec9(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@ASN1_BIT_STRING_it = global i32 0
define void @ASN1_BIT_STRING_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @ASN1_BIT_STRING_it)
ret void
}

LLVM IR (-O2):
@ASN1_BIT_STRING_it = global i32 0
define void @ASN1_BIT_STRING_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @ASN1_BIT_STRING_it)
ret void
}
/* Type definitions */
struct voice_t {
  int dummy;
};

/* Variables and functions */
int apply_gen_envx(struct voice_t *, int);
int apply_gen_volume(struct voice_t *, int, int *, int *);
int gaussian_slow_amp(struct voice_t *voice, int output, int *amp_0,
                      int *amp_1) {
  output = apply_gen_envx(voice, output) & ~1;
  output = apply_gen_volume(voice, output, amp_0, amp_1);
  return output;
}


x86 assembly (clang, -O0):
<gaussian_slow_amp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <apply_gen_envx@plt>
and    $0xfffffffe,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <apply_gen_volume@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaussian_slow_amp>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%rbx
call   1040 <apply_gen_envx@plt>
and    $0xfffffffe,%eax
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <apply_gen_volume@plt>

LLVM IR (-O0):
%struct.voice_t = type { i32 }
define i32 @gaussian_slow_amp(%struct.voice_t* %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca %struct.voice_t*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store %struct.voice_t* %0, %struct.voice_t** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load %struct.voice_t*, %struct.voice_t** %5
%10 = load i32, i32* %6
%11 = call i32 @apply_gen_envx(%struct.voice_t* %9, i32 %10)
%12 = and i32 %11, -2
store i32 %12, i32* %6
%13 = load %struct.voice_t*, %struct.voice_t** %5
%14 = load i32, i32* %6
%15 = load i32*, i32** %7
%16 = load i32*, i32** %8
%17 = call i32 @apply_gen_volume(%struct.voice_t* %13, i32 %14, i32* %15, i32* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
ret i32 %18
}

LLVM IR (-O2):
%struct.voice_t = type { i32 }
define i32 @gaussian_slow_amp(%struct.voice_t* %0, i32 %1, i32* %2, i32* %3) {
%5 = tail call i32 @apply_gen_envx(%struct.voice_t* %0, i32 %1)
%6 = and i32 %5, -2
%7 = tail call i32 @apply_gen_volume(%struct.voice_t* %0, i32 %6, i32* %2, i32* %3)
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
unsigned char ELFDATA2LSB;
unsigned char ELFDATA2MSB;
unsigned char endianness(void) {
  uint16_t two_byte = 0x00FF;
  uint8_t low_address = *((uint8_t *)&two_byte);
  if (low_address == 0)
    return ELFDATA2MSB;
  else
    return ELFDATA2LSB;
}


x86 assembly (clang, -O0):
<endianness>:
push   %rbp
mov    %rsp,%rbp
movl   $0xff,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112f <endianness+0x2f>
mov    0x2eb3(%rip),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    113b <endianness+0x3b>
mov    0x2eba(%rip),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<endianness>:
mov    0x2ee9(%rip),%rax
mov    (%rax),%al
ret

LLVM IR (-O0):
@ELFDATA2MSB = global i8 0
@ELFDATA2LSB = global i8 0
define zeroext i8 @endianness() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i64
store i32 255, i32* %2
%4 = bitcast i32* %2 to i64*
%5 = load i64, i64* %4
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = load i8, i8* @ELFDATA2MSB
store i8 %9, i8* %1
br label %12
10: ; preds = %0
%11 = load i8, i8* @ELFDATA2LSB
store i8 %11, i8* %1
br label %12
12: ; preds = %10, %8
%13 = load i8, i8* %1
ret i8 %13
}

LLVM IR (-O2):
@ELFDATA2MSB = global i8 0
@ELFDATA2LSB = global i8 0
define zeroext i8 @endianness() {
%1 = load i8, i8* @ELFDATA2LSB
ret i8 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ block128_f;
typedef int /*<<< orphan*/ CAMELLIA_KEY;

/* Variables and functions */
int /*<<< orphan*/ CRYPTO_cfb128_encrypt(unsigned char const *, unsigned char *,
                                         size_t, int /*<<< orphan*/ const *,
                                         unsigned char *, int *, int const,
                                         int /*<<< orphan*/);
scalar_t__ Camellia_encrypt;
void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
                             size_t length, const CAMELLIA_KEY *key,
                             unsigned char *ivec, int *num, const int enc) {
  CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc,
                        (block128_f)Camellia_encrypt);
}


x86 assembly (clang, -O0):
<Camellia_cfb128_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10d
mov    0x2ea2(%rip),%rax
mov    (%rax),%rax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <CRYPTO_cfb128_encrypt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Camellia_cfb128_encrypt>:
push   %rax
mov    0x10(%rsp),%r10d
mov    0x2edb(%rip),%rax
mov    (%rax),%eax
push   %rax
push   %r10
call   1030 <CRYPTO_cfb128_encrypt@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@Camellia_encrypt = global i64 0
define void @Camellia_cfb128_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i64 %2, i64* %10
store i32* %3, i32** %11
store i8* %4, i8** %12
store i32* %5, i32** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = load i32*, i32** %11
%19 = load i8*, i8** %12
%20 = load i32*, i32** %13
%21 = load i32, i32* %14
%22 = load i64, i64* @Camellia_encrypt
%23 = trunc i64 %22 to i32
%24 = call i32 @CRYPTO_cfb128_encrypt(i8* %15, i8* %16, i64 %17, i32* %18, i8* %19, i32* %20, i32 %21, i32 %23)
ret void
}

LLVM IR (-O2):
@Camellia_encrypt = global i64 0
define void @Camellia_cfb128_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6) {
%8 = load i64, i64* @Camellia_encrypt
%9 = trunc i64 %8 to i32
%10 = tail call i32 @CRYPTO_cfb128_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6, i32 %9)
ret void
}
int get_r(void) { return 10 % 10; }


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

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

LLVM IR (-O0):
define i32 @get_r() {
ret i32 0
}

LLVM IR (-O2):
define i32 @get_r() {
ret i32 0
}
int f(int x, int y) { return (x + y); }


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

x86 assembly (clang, -O2):
<f>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @f(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
size_t *get_malloc_address_location(void *const);
void set_actual_malloc_address(void *const mem, const void *const malloc_addr) {
  size_t *const malloc_addr_location = get_malloc_address_location(mem);
  *malloc_addr_location = (size_t)malloc_addr;
}


x86 assembly (clang, -O0):
<set_actual_malloc_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_malloc_address_location@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_actual_malloc_address>:
push   %rbx
mov    %rsi,%rbx
call   1030 <get_malloc_address_location@plt>
mov    %rbx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @set_actual_malloc_address(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64* @get_malloc_address_location(i8* %6)
store i64* %7, i64** %5
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
%10 = load i64*, i64** %5
store i64 %9, i64* %10
ret void
}

LLVM IR (-O2):
define void @set_actual_malloc_address(i8* %0, i8* %1) {
%3 = tail call i64* @get_malloc_address_location(i8* %0)
%4 = ptrtoint i8* %1 to i64
store i64 %4, i64* %3
ret void
}
/* Variables and functions */
int foo();
int main(void) { return foo(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
ret i32 %1
}
int compare_doubles(const void *aPtr, const void *bPtr) {
  double a = *((double *)aPtr);
  double b = *((double *)bPtr);
  if (a > b)
    return 1;
  if (a < b)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<compare_doubles>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1142 <compare_doubles+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1169 <compare_doubles+0x69>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1162 <compare_doubles+0x62>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <compare_doubles+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_doubles>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_doubles(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp olt double %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int uint16_t;
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ STDIN_FILENO;
scalar_t__ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, struct timeval *);
uint16_t check_key() {
  fd_set readfds;
  FD_ZERO(&readfds);
  FD_SET(STDIN_FILENO, &readfds);
  struct timeval timeout;
  timeout.tv_sec = 0;
  timeout.tv_usec = 0;
  return select(1, &readfds, NULL, NULL, &timeout) != 0;
}


x86 assembly (clang, -O0):
<check_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
call   1030 <FD_ZERO@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
call   1050 <FD_SET@plt>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1040 <select@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_key>:
push   %rbx
sub    $0x20,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <FD_ZERO@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1050 <FD_SET@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%r8
mov    $0x1,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <select@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@STDIN_FILENO = global i32 0
define i32 @check_key() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = call i32 @FD_ZERO(i32* %1)
%4 = load i32, i32* @STDIN_FILENO
%5 = call i32 @FD_SET(i32 %4, i32* %1)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
store i64 0, i64* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
store i64 0, i64* %7
%8 = call i64 @select(i32 1, i32* %1, i32* null, i32* null, %struct.timeval* %2)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@STDIN_FILENO = global i32 0
define i32 @check_key() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = bitcast i32* %1 to i8*
%4 = call i32 @FD_ZERO(i32* %1)
%5 = load i32, i32* @STDIN_FILENO
%6 = call i32 @FD_SET(i32 %5, i32* %1)
%7 = bitcast %struct.timeval* %2 to i8*
%8 = bitcast %struct.timeval* %2 to i8*
%9 = call i64 @select(i32 1, i32* %1, i32* null, i32* null, %struct.timeval* %2)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ displayBits(unsigned int);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main() {
  unsigned u1;
  scanf("%u", &u1);
  displayBits(u1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1040 <displayBits@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <displayBits@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%u\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 @displayBits(i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ spi_transfer(unsigned char);
void mag_command(int axis) {
  unsigned char cmd = 0;
  switch (axis) {
  case 0:
    cmd |= 2;
    break;
  case 1:
    cmd |= 1;
    break;
  case 2:
    cmd |= 3;
    break;
  }
  cmd |= 16 | 32 | 64;
  spi_transfer(cmd);
}


x86 assembly (clang, -O0):
<mag_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1154 <mag_command+0x44>
jmp    1132 <mag_command+0x22>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1163 <mag_command+0x53>
jmp    1143 <mag_command+0x33>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1172 <mag_command+0x62>
jmp    117c <mag_command+0x6c>
movzbl -0x5(%rbp),%eax
or     $0x2,%eax
mov    %al,-0x5(%rbp)
jmp    117c <mag_command+0x6c>
movzbl -0x5(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x5(%rbp)
jmp    117c <mag_command+0x6c>
movzbl -0x5(%rbp),%eax
or     $0x3,%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
or     $0x70,%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%edi
call   1030 <spi_transfer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mag_command>:
lea    0x0(,%rdi,8),%ecx
mov    $0x737172,%eax
shr    %cl,%eax
cmp    $0x3,%edi
mov    $0x70,%ecx
cmovb  %eax,%ecx
movzbl %cl,%edi
jmp    1030 <spi_transfer@plt>

LLVM IR (-O0):
define void @mag_command(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
store i8 0, i8* %3
%4 = load i32, i32* %2
switch i32 %4, label %20 [
i32 0, label %5
i32 1, label %10
i32 2, label %15
]
5: ; preds = %1
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = or i32 %7, 2
%9 = trunc i32 %8 to i8
store i8 %9, i8* %3
br label %20
10: ; preds = %1
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %12, 1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
br label %20
15: ; preds = %1
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = or i32 %17, 3
%19 = trunc i32 %18 to i8
store i8 %19, i8* %3
br label %20
20: ; preds = %1, %15, %10, %5
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = or i32 %22, 112
%24 = trunc i32 %23 to i8
store i8 %24, i8* %3
%25 = load i8, i8* %3
%26 = call i32 @spi_transfer(i8 zeroext %25)
ret void
}

LLVM IR (-O2):
define void @mag_command(i32 %0) {
%2 = icmp ult i32 %0, 3
%3 = trunc i32 %0 to i24
%4 = shl i24 %3, 3
%5 = lshr i24 7565682, %4
%6 = trunc i24 %5 to i8
%7 = select i1 %2, i8 %6, i8 112
%8 = tail call i32 @spi_transfer(i8 zeroext %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_PKEY;

/* Variables and functions */
#define ASN1_PKEY_CTRL_DEFAULT_MD_NID 128
int NID_sha1;
int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) {
  switch (op) {
  case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
    *(int *)arg2 = NID_sha1;
    return 1;
  default:
    return -2;
  }
}


x86 assembly (clang, -O0):
<hmac_pkey_ctrl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
jne    1141 <hmac_pkey_ctrl+0x41>
jmp    1126 <hmac_pkey_ctrl+0x26>
mov    0x2eb3(%rip),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1148 <hmac_pkey_ctrl+0x48>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hmac_pkey_ctrl>:
mov    $0xfffffffe,%eax
cmp    $0x80,%esi
jne    111d <hmac_pkey_ctrl+0x1d>
mov    0x2ecc(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rcx)
mov    $0x1,%eax
ret

LLVM IR (-O0):
@NID_sha1 = global i32 0
define i32 @hmac_pkey_ctrl(i32* %0, i32 %1, i64 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i8* %3, i8** %9
%10 = load i32, i32* %7
switch i32 %10, label %15 [
i32 128, label %11
]
11: ; preds = %4
%12 = load i32, i32* @NID_sha1
%13 = load i8*, i8** %9
%14 = bitcast i8* %13 to i32*
store i32 %12, i32* %14
store i32 1, i32* %5
br label %16
15: ; preds = %4
store i32 -2, i32* %5
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@NID_sha1 = global i32 0
define i32 @hmac_pkey_ctrl(i32* nocapture readnone %0, i32 %1, i64 %2, i8* nocapture writeonly %3) {
%5 = icmp eq i32 %1, 128
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = load i32, i32* @NID_sha1
%8 = bitcast i8* %3 to i32*
store i32 %7, i32* %8
br label %9
9: ; preds = %4, %6
%10 = phi i32 [ 1, %6 ], [ -2, %4 ]
ret i32 %10
}
/* Variables and functions */
float __tgammaf_r(float, int *);
float tgammaf(float x) {
  int local_sgngamf = 0;
  return (__tgammaf_r(x, &local_sgngamf));
}


x86 assembly (clang, -O0):
<tgammaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
lea    -0x8(%rbp),%rdi
call   1030 <__tgammaf_r@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tgammaf>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <__tgammaf_r@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define float @tgammaf(float %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call float @__tgammaf_r(float %0, i32* %2)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  if (argc > 1) {
    ;
  } else
    puts("No Input File Provided");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1135 <main+0x25>
jmp    1141 <main+0x31>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
jg     1126 <main+0x16>
push   %rax
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"No Input File Provided\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %11
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"No Input File Provided\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %4
ret i32 0
}
void plshift(void *L, void *M, void *r) {
  void **l = L, **m = M;
  *l = *m, *m = r;
}


x86 assembly (clang, -O0):
<plshift>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<plshift>:
mov    (%rsi),%rax
mov    %rax,(%rdi)
mov    %rdx,(%rsi)
ret

LLVM IR (-O0):
define void @plshift(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8**
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %7
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i8**
store i8** %12, i8*** %8
%13 = load i8**, i8*** %8
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %7
store i8* %14, i8** %15
%16 = load i8*, i8** %6
%17 = load i8**, i8*** %8
store i8* %16, i8** %17
ret void
}

LLVM IR (-O2):
define void @plshift(i8* nocapture writeonly %0, i8* nocapture %1, i8* %2) {
%4 = bitcast i8* %0 to i8**
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
store i8* %6, i8** %4
store i8* %2, i8** %5
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint64_t;

/* Variables and functions */
uint64_t tsaf_get_pcrext(const uint8_t *p_ts) {
  return ((p_ts[10] & 1) << 8) | p_ts[11];
}


x86 assembly (clang, -O0):
<tsaf_get_pcrext>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%eax
and    $0x1,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x2c(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsaf_get_pcrext>:
mov    0x28(%rdi),%eax
and    $0x1,%eax
shl    $0x8,%eax
or     0x2c(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @tsaf_get_pcrext(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 10
%5 = load i32, i32* %4
%6 = and i32 %5, 1
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 11
%10 = load i32, i32* %9
%11 = or i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @tsaf_get_pcrext(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 10
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = and i32 %4, 256
%6 = getelementptr inbounds i32, i32* %0, i64 11
%7 = load i32, i32* %6
%8 = or i32 %5, %7
ret i32 %8
}
void ReadLevel(char *filename) {}


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

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

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

LLVM IR (-O2):
define void @ReadLevel(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ __stdfix_sat_ulr(scalar_t__);
uint32_t __stdfix_ssub_ulr(uint32_t x, uint32_t y) {
  return (__stdfix_sat_ulr((uint64_t)x - (uint64_t)y));
}


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

x86 assembly (clang, -O2):
<__stdfix_ssub_ulr>:
sub    %rsi,%rdi
jmp    1030 <__stdfix_sat_ulr@plt>

LLVM IR (-O0):
define i64 @__stdfix_ssub_ulr(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 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
%8 = call i64 @__stdfix_sat_ulr(i64 %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @__stdfix_ssub_ulr(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = tail call i64 @__stdfix_sat_ulr(i64 %3)
ret i64 %4
}
/* Variables and functions */
int EAGAIN;
int EINTR;
int ENOMEM;
bool wait_should_retry(int error) {
  if (error == EINTR || error == EAGAIN || error == ENOMEM) {
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<wait_should_retry>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ec7(%rip),%rcx
cmp    (%rcx),%eax
je     113d <wait_should_retry+0x3d>
mov    -0x8(%rbp),%eax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     113d <wait_should_retry+0x3d>
mov    -0x8(%rbp),%eax
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%eax
jne    1149 <wait_should_retry+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1150 <wait_should_retry+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_should_retry>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
sete   %al
mov    0x2eb5(%rip),%rcx
cmp    %edi,(%rcx)
sete   %cl
or     %al,%cl
mov    0x2ebf(%rip),%rax
cmp    %edi,(%rax)
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
@EINTR = global i32 0
@EAGAIN = global i32 0
@ENOMEM = global i32 0
define i32 @wait_should_retry(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @EINTR
%6 = icmp eq i32 %4, %5
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* @EAGAIN
%10 = icmp eq i32 %8, %9
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* @ENOMEM
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11, %7, %1
store i32 1, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@EINTR = global i32 0
@EAGAIN = global i32 0
@ENOMEM = global i32 0
define i32 @wait_should_retry(i32 %0) {
%2 = load i32, i32* @EINTR
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @EAGAIN
%5 = icmp eq i32 %4, %0
%6 = select i1 %3, i1 true, i1 %5
%7 = load i32, i32* @ENOMEM
%8 = icmp eq i32 %7, %0
%9 = select i1 %6, i1 true, i1 %8
%10 = zext i1 %9 to i32
ret i32 %10
}
char *RCSid() {
  return RCSid("$Id: gplt_x11.c,v 1.210.2.6 2013/08/24 22:46:46 sfeam Exp $");
}


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

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

LLVM IR (-O0):
@.str = [60 x i8] c"$Id: gplt_x11.c,v 1.210.2.6 2013/08/24 22:46:46 sfeam Exp $\00"
define i8* @RCSid() {
%1 = call i8* (i8*, ...) bitcast (i8* ()* @RCSid to i8* (i8*, ...)*)(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @RCSid() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ do_cmd(char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int i;
  setbuf(stdout, NULL);
  for (i = 1; i < argc; i++) {
    do_cmd(argv[i]);
  }
  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)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117a <main+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <do_cmd@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
cmp    $0x2,%ebp
jl     1162 <main+0x42>
mov    %ebp,%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1040 <do_cmd@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdout
%8 = call i32 @setbuf(i32 %7, i32* null)
store i32 1, i32* %6
br label %9
9: ; preds = %20, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @do_cmd(i8* %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %9
23: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @setbuf(i32 %3, i32* null)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 1, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @do_cmd(i8* %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void drawLine(int n, char c) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%c", c);
    ;
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<drawLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1154 <drawLine+0x44>
movsbl -0x5(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <drawLine+0x18>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawLine>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    113c <drawLine+0x1c>
mov    %edi,%ebx
movsbl %sil,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1130 <drawLine+0x10>
lea    0xebd(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [3 x i8] c"\0A\0A\00"
define void @drawLine(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
store i32 %0, i32* %3
store i8 %1, i8* %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c"\0A\00"
define void @drawLine(i32 %0, i8 signext %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sext i8 %1 to i32
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %9, %6 ]
%8 = tail call i32 @putchar(i32 %5)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %0
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
void toi_alloc_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @toi_alloc_exit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int sum(int m) {
  int i = 0, n = 0;
  for (i = 1; i <= m; i++) {
    n += i;
  }
  printf("The sum of 1-%d is %d\r\n", m, n);
  return 0;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1153 <sum+0x43>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <sum+0x20>
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
mov    %edi,%esi
test   %edi,%edi
jle    112b <sum+0x1b>
lea    -0x1(%rsi),%eax
lea    -0x2(%rsi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rsi,2),%edx
add    $0xffffffff,%edx
jmp    112d <sum+0x1d>
xor    %edx,%edx
push   %rax
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"The sum of 1-%d is %d\0D\0A\00"
define i32 @sum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %3
br label %5
5: ; preds = %13, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %11, %10
store i32 %12, i32* %4
br label %13
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %5
16: ; preds = %5
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"The sum of 1-%d is %d\0D\0A\00"
define i32 @sum(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %15)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void errorLongExpr(void) { error("Too long expression\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Too long expression\0A\00"
define void @errorLongExpr() {
%1 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Too long expression\0A\00"
define void @errorLongExpr() {
%1 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ crc16(int /*<<< orphan*/ const *, size_t, int, int);
uint16_t crc16_ansi(const uint8_t *src, size_t len) {
  return crc16(src, len, 0x8005, 0xffff);
}


x86 assembly (clang, -O0):
<crc16_ansi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8005,%edx
mov    $0xffff,%ecx
call   1030 <crc16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc16_ansi>:
mov    $0x8005,%edx
mov    $0xffff,%ecx
jmp    1030 <crc16@plt>

LLVM IR (-O0):
define i32 @crc16_ansi(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = load i64, i64* %4
%7 = call i32 @crc16(i32* %5, i64 %6, i32 32773, i32 65535)
ret i32 %7
}

LLVM IR (-O2):
define i32 @crc16_ansi(i32* %0, i64 %1) {
%3 = tail call i32 @crc16(i32* %0, i64 %1, i32 32773, i32 65535)
ret i32 %3
}
/* Type definitions */
struct vec2i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec2i_divide(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ *);
__attribute__((always_)) struct vec2i *
psvec2i_divide(struct vec2i *result, struct vec2i *a, struct vec2i *b) {
  vec2i_divide((int32_t *)result, (int32_t *)a, (int32_t *)b);
  return result;
}


x86 assembly (clang, -O0):
<psvec2i_divide>:
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 <vec2i_divide@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec2i_divide>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec2i_divide@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec2i = type { i32 }
define %struct.vec2i* @psvec2i_divide(%struct.vec2i* %0, %struct.vec2i* %1, %struct.vec2i* %2) {
%4 = alloca %struct.vec2i*
%5 = alloca %struct.vec2i*
%6 = alloca %struct.vec2i*
store %struct.vec2i* %0, %struct.vec2i** %4
store %struct.vec2i* %1, %struct.vec2i** %5
store %struct.vec2i* %2, %struct.vec2i** %6
%7 = load %struct.vec2i*, %struct.vec2i** %4
%8 = bitcast %struct.vec2i* %7 to i32*
%9 = load %struct.vec2i*, %struct.vec2i** %5
%10 = bitcast %struct.vec2i* %9 to i32*
%11 = load %struct.vec2i*, %struct.vec2i** %6
%12 = bitcast %struct.vec2i* %11 to i32*
%13 = call i32 @vec2i_divide(i32* %8, i32* %10, i32* %12)
%14 = load %struct.vec2i*, %struct.vec2i** %4
ret %struct.vec2i* %14
}

LLVM IR (-O2):
%struct.vec2i = type { i32 }
define %struct.vec2i* @psvec2i_divide(%struct.vec2i* returned %0, %struct.vec2i* %1, %struct.vec2i* %2) {
%4 = getelementptr %struct.vec2i, %struct.vec2i* %0, i64 0, i32 0
%5 = getelementptr %struct.vec2i, %struct.vec2i* %1, i64 0, i32 0
%6 = getelementptr %struct.vec2i, %struct.vec2i* %2, i64 0, i32 0
%7 = tail call i32 @vec2i_divide(i32* %4, i32* %5, i32* %6)
ret %struct.vec2i* %0
}
void nseel_asm_fptobool_end(void) {}


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

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

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

LLVM IR (-O2):
define void @nseel_asm_fptobool_end() {
ret void
}
/* Variables and functions */
scalar_t__ floorf(float);
int Round(float value) { return ((int)floorf(value + 0.5f)); }


x86 assembly (clang, -O0):
<Round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
call   1030 <floorf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Round>:
addss  0xee8(%rip),%xmm0
jmp    1030 <floorf@plt>

LLVM IR (-O0):
define i32 @Round(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fadd float %3, 5.000000e-01
%5 = call i64 @floorf(float %4)
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @Round(float %0) {
%2 = fadd float %0, 5.000000e-01
%3 = tail call i64 @floorf(float %2)
%4 = trunc i64 %3 to i32
ret i32 %4
}
int d_lt_mr2(double *a1, double a2) { return !(((*a1) < (a2))); }


x86 assembly (clang, -O0):
<d_lt_mr2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_lt_mr2>:
xor    %eax,%eax
ucomisd (%rdi),%xmm0
setbe  %al
ret

LLVM IR (-O0):
define i32 @d_lt_mr2(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
store double* %0, double** %3
store double %1, double* %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = load double, double* %4
%8 = fcmp olt double %6, %7
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @d_lt_mr2(double* nocapture %0, double %1) {
%3 = load double, double* %0
%4 = fcmp uge double %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
char *dummy_ngettext(const char *msgid1, const char *msgid2,
                     unsigned long int n) {
  return (char *)(n == 1 ? msgid1 : msgid2);
}


x86 assembly (clang, -O0):
<dummy_ngettext>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jne    1128 <dummy_ngettext+0x28>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1130 <dummy_ngettext+0x30>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dummy_ngettext>:
mov    %rdi,%rax
cmp    $0x1,%rdx
cmovne %rsi,%rax
ret

LLVM IR (-O0):
define i8* @dummy_ngettext(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 i64, i64* %6
%8 = icmp eq i64 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i8*, i8** %4
br label %13
11: ; preds = %3
%12 = load i8*, i8** %5
br label %13
13: ; preds = %11, %9
%14 = phi i8* [ %10, %9 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @dummy_ngettext(i8* readnone %0, i8* readnone %1, i64 %2) {
%4 = icmp eq i64 %2, 1
%5 = select i1 %4, i8* %0, i8* %1
ret i8* %5
}
/* Variables and functions */
int setBit(int, int);
int setOffSet(int mask, int offset) {
  int i;
  for (i = 0; i < offset; i++) {
    mask = setBit(mask, i);
  }
  return mask;
}


x86 assembly (clang, -O0):
<setOffSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114d <setOffSet+0x3d>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <setBit@plt>
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <setOffSet+0x15>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setOffSet>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%eax
test   %esi,%esi
jle    1130 <setOffSet+0x20>
mov    %esi,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    %eax,%edi
mov    %ebp,%esi
call   1030 <setBit@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <setOffSet+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @setOffSet(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 = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = call i32 @setBit(i32 %11, i32 %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @setOffSet(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = tail call i32 @setBit(i32 %6, i32 %5)
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i32 [ %0, %2 ], [ %7, %4 ]
ret i32 %11
}