xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

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


x86 assembly (clang, -O0):
<isDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     114f <isDirectory+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    115a <isDirectory+0x3a>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDirectory>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <isDirectory+0x15>
pop    %rcx
ret
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isDirectory(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
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @S_ISDIR(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int);
int /*<<< orphan*/ stderr;
void rmotion(int x, int y, int z) {
  fprintf(stderr, "Spaceball rotate %d %d %d\n", x, y, z);
}


x86 assembly (clang, -O0):
<rmotion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmotion>:
mov    %edx,%r8d
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Spaceball rotate %d %d %d\0A\00"
define void @rmotion(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @stderr
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Spaceball rotate %d %d %d\0A\00"
define void @rmotion(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ I2C_start();
int /*<<< orphan*/ I2C_stop();
int /*<<< orphan*/ I2C_write(unsigned char);
void EEPROM_set(unsigned int addr, unsigned char val) {
  I2C_start();
  I2C_write(0xA0);
  I2C_write(addr & 0xF0);
  I2C_write(addr & 0x0F);
  I2C_write(val);
  I2C_stop();
}


x86 assembly (clang, -O0):
<EEPROM_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    $0x0,%al
call   1040 <I2C_start@plt>
mov    $0xa0,%edi
call   1050 <I2C_write@plt>
mov    -0x4(%rbp),%eax
and    $0xf0,%eax
movzbl %al,%edi
call   1050 <I2C_write@plt>
mov    -0x4(%rbp),%eax
and    $0xf,%eax
movzbl %al,%edi
call   1050 <I2C_write@plt>
movzbl -0x5(%rbp),%edi
call   1050 <I2C_write@plt>
mov    $0x0,%al
call   1030 <I2C_stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROM_set>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <I2C_start@plt>
mov    $0xa0,%edi
call   1050 <I2C_write@plt>
mov    %ebp,%edi
and    $0xf0,%edi
call   1050 <I2C_write@plt>
and    $0xf,%ebp
mov    %ebp,%edi
call   1050 <I2C_write@plt>
mov    %ebx,%edi
call   1050 <I2C_write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <I2C_stop@plt>

LLVM IR (-O0):
define void @EEPROM_set(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = call i32 (...) @I2C_start()
%6 = call i32 @I2C_write(i8 zeroext -96)
%7 = load i32, i32* %3
%8 = and i32 %7, 240
%9 = trunc i32 %8 to i8
%10 = call i32 @I2C_write(i8 zeroext %9)
%11 = load i32, i32* %3
%12 = and i32 %11, 15
%13 = trunc i32 %12 to i8
%14 = call i32 @I2C_write(i8 zeroext %13)
%15 = load i8, i8* %4
%16 = call i32 @I2C_write(i8 zeroext %15)
%17 = call i32 (...) @I2C_stop()
ret void
}

LLVM IR (-O2):
define void @EEPROM_set(i32 %0, i8 zeroext %1) {
%3 = tail call i32 (...) @I2C_start()
%4 = tail call i32 @I2C_write(i8 zeroext -96)
%5 = trunc i32 %0 to i8
%6 = and i8 %5, -16
%7 = tail call i32 @I2C_write(i8 zeroext %6)
%8 = and i8 %5, 15
%9 = tail call i32 @I2C_write(i8 zeroext %8)
%10 = tail call i32 @I2C_write(i8 zeroext %1)
%11 = tail call i32 (...) @I2C_stop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M905_f(char *s) {
  debug("M905_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M905_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M905_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M905_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M905_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M905_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M905_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
char *GlobalEntity_GetIndex(char const *);
void GlobalEntity_SetCounter(const char *pGlobalName, int counter) {
  GlobalEntity_SetCounter(GlobalEntity_GetIndex(pGlobalName), counter);
}


x86 assembly (clang, -O0):
<GlobalEntity_SetCounter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <GlobalEntity_GetIndex@plt>
mov    %rax,%rdi
mov    -0xc(%rbp),%esi
call   1030 <GlobalEntity_SetCounter@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GlobalEntity_SetCounter>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <GlobalEntity_GetIndex@plt>
mov    %rax,%rdi
jmp    1120 <GlobalEntity_SetCounter+0x10>

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

LLVM IR (-O2):
define void @GlobalEntity_SetCounter(i8* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = tail call i8* @GlobalEntity_GetIndex(i8* %4)
br label %3
}
char check_extern(char *name) { return 0; }


x86 assembly (clang, -O0):
<check_extern>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
movsbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @check_extern(i8* nocapture readnone %0) {
ret i8 0
}
int fun668() { return 668; }


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

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

LLVM IR (-O0):
define i32 @fun668() {
ret i32 668
}

LLVM IR (-O2):
define i32 @fun668() {
ret i32 668
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, unsigned char *, int);
double R8(unsigned char *p) {
  double r = 0.0;
  memcpy(&r, p, 8);
  return r;
}


x86 assembly (clang, -O0):
<R8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<R8>:
push   %rax
mov    %rdi,%rsi
movq   $0x0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @R8(i8* %0) {
%2 = alloca i8*
%3 = alloca double
store i8* %0, i8** %2
store double 0.000000e+00, double* %3
%4 = load i8*, i8** %2
%5 = call i32 @memcpy(double* %3, i8* %4, i32 8)
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @R8(i8* %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%4 = call i32 @memcpy(double* %2, i8* %0, i32 8)
%5 = load double, double* %2
ret double %5
}
/* Type definitions */
struct Hero {
  int dummy;
};
struct Ability {
  int dummy;
};

/* Variables and functions */
float damage_RollAttack(struct Hero *);
float HuBenBiFa_damage(struct Ability *self, struct Hero *attacker,
                       struct Hero *target) {
  return damage_RollAttack(attacker) * (float)(1.50);
}


x86 assembly (clang, -O0):
<HuBenBiFa_damage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <damage_RollAttack@plt>
movss  0xecb(%rip),%xmm1
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HuBenBiFa_damage>:
push   %rax
mov    %rsi,%rdi
call   1030 <damage_RollAttack@plt>
mulss  0xedf(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.Ability = type { i32 }
%struct.Hero = type { i32 }
define float @HuBenBiFa_damage(%struct.Ability* %0, %struct.Hero* %1, %struct.Hero* %2) {
%4 = alloca %struct.Ability*
%5 = alloca %struct.Hero*
%6 = alloca %struct.Hero*
store %struct.Ability* %0, %struct.Ability** %4
store %struct.Hero* %1, %struct.Hero** %5
store %struct.Hero* %2, %struct.Hero** %6
%7 = load %struct.Hero*, %struct.Hero** %5
%8 = call float @damage_RollAttack(%struct.Hero* %7)
%9 = fmul float %8, 1.500000e+00
ret float %9
}

LLVM IR (-O2):
%struct.Ability = type { i32 }
%struct.Hero = type { i32 }
define float @HuBenBiFa_damage(%struct.Ability* nocapture readnone %0, %struct.Hero* %1, %struct.Hero* nocapture readnone %2) {
%4 = tail call float @damage_RollAttack(%struct.Hero* %1)
%5 = fmul float %4, 1.500000e+00
ret float %5
}
/* Variables and functions */
int isc40(unsigned char const);
int istext(unsigned char const);
int isc40text(const int current_mode, const unsigned char input) {
  return current_mode == 2 ? isc40(input) : istext(input);
}


x86 assembly (clang, -O0):
<isc40text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    114c <isc40text+0x2c>
movzbl -0x5(%rbp),%edi
call   1040 <isc40@plt>
mov    %eax,-0xc(%rbp)
jmp    1158 <isc40text+0x38>
movzbl -0x5(%rbp),%edi
call   1030 <istext@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isc40text>:
cmp    $0x2,%edi
jne    112e <isc40text+0xe>
movzbl %sil,%edi
jmp    1040 <isc40@plt>
movzbl %sil,%edi
jmp    1030 <istext@plt>

LLVM IR (-O0):
define i32 @isc40text(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8, i8* %4
%9 = call i32 @isc40(i8 zeroext %8)
br label %13
10: ; preds = %2
%11 = load i8, i8* %4
%12 = call i32 @istext(i8 zeroext %11)
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ %9, %7 ], [ %12, %10 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @isc40text(i32 %0, i8 zeroext %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @isc40(i8 zeroext %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @istext(i8 zeroext %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void loop_signal_handler_usr1(int signal_number) {
  (void)(signal_number);
  printf("Got SIGUSR1.\n");
}


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Got SIGUSR1.\00"
define void @loop_signal_handler_usr1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
BOOST_AUTO_TEST_CASE(arctanh) { TESTCASE1(arctanh, 0, 0); }


x86 assembly (clang, -O0):
<BOOST_AUTO_TEST_CASE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <TESTCASE1@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BOOST_AUTO_TEST_CASE>:
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
jmp    1030 <TESTCASE1@plt>

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

LLVM IR (-O2):
define i32 @BOOST_AUTO_TEST_CASE(i32 %0) {
%2 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %0, i32 0, i32 0)
ret i32 undef
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t hex_convert(const uint8_t c) {
  return (uint8_t)((c & 15) + (c >> 6) * 9);
}


x86 assembly (clang, -O0):
<hex_convert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    -0x4(%rbp),%ecx
sar    $0x6,%ecx
imul   $0x9,%ecx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_convert>:
mov    %edi,%ecx
and    $0xf,%ecx
sar    $0x6,%edi
lea    (%rdi,%rdi,8),%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hex_convert(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = load i32, i32* %2
%6 = ashr i32 %5, 6
%7 = mul nsw i32 %6, 9
%8 = add nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @hex_convert(i32 %0) {
%2 = and i32 %0, 15
%3 = ashr i32 %0, 6
%4 = mul nsw i32 %3, 9
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ out_of_memory();
void check_malloc_return(const void *p) {
  if (!p) {
    out_of_memory();
  }
}


x86 assembly (clang, -O0):
<check_malloc_return>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112e <check_malloc_return+0x1e>
mov    $0x0,%al
call   1030 <out_of_memory@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_malloc_return>:
test   %rdi,%rdi
je     1116 <check_malloc_return+0x6>
ret
xor    %eax,%eax
jmp    1030 <out_of_memory@plt>

LLVM IR (-O0):
define void @check_malloc_return(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 (...) @out_of_memory()
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @check_malloc_return(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @out_of_memory()
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
struct _stor_fcreate_rsp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _stor_fcreate_rsp *);
void stor_fcreate_rsp_free(struct _stor_fcreate_rsp *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<stor_fcreate_rsp_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct._stor_fcreate_rsp = type { i32 }
define void @stor_fcreate_rsp_free(%struct._stor_fcreate_rsp* %0) {
%2 = alloca %struct._stor_fcreate_rsp*
store %struct._stor_fcreate_rsp* %0, %struct._stor_fcreate_rsp** %2
%3 = load %struct._stor_fcreate_rsp*, %struct._stor_fcreate_rsp** %2
%4 = call i32 @free(%struct._stor_fcreate_rsp* %3)
ret void
}

LLVM IR (-O2):
%struct._stor_fcreate_rsp = type { i32 }
define void @stor_fcreate_rsp_free(%struct._stor_fcreate_rsp* nocapture %0) {
%2 = tail call i32 @free(%struct._stor_fcreate_rsp* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  exit(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)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
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 = load i8**, i8*** %5
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
purgeline() {}


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

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

LLVM IR (-O0):
define i32 @purgeline() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @purgeline() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ *strchr(char *, int);
int is_measure_separator(int c) { return (strchr("|", c) != NULL); }


x86 assembly (clang, -O0):
<is_measure_separator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_measure_separator>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <strchr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
define i32 @is_measure_separator(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32* @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
define i32 @is_measure_separator(i32 %0) {
%2 = tail call i32* @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double fabs(double);
double sign(double a, double b) { return b >= 0 ? fabs(a) : -fabs(a); }


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     113a <sign+0x3a>
movsd  -0x8(%rbp),%xmm0
movaps 0xed4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1166 <sign+0x66>
movsd  -0x8(%rbp),%xmm0
movaps 0xeba(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
movapd 0xef8(%rip),%xmm2
andpd  %xmm0,%xmm2
orpd   0xefc(%rip),%xmm0
xorpd  %xmm3,%xmm3
cmpnlesd %xmm1,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @sign(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp oge double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load double, double* %3
%9 = call double @llvm.fabs.f64(double %8)
br label %14
10: ; preds = %2
%11 = load double, double* %3
%12 = call double @llvm.fabs.f64(double %11)
%13 = fneg double %12
br label %14
14: ; preds = %10, %7
%15 = phi double [ %9, %7 ], [ %13, %10 ]
ret double %15
}

LLVM IR (-O2):
define double @sign(double %0, double %1) {
%3 = fcmp ult double %1, 0.000000e+00
%4 = tail call double @llvm.fabs.f64(double %0)
%5 = fneg double %4
%6 = select i1 %3, double %5, double %4
ret double %6
}
void g_async_queue_pop_unlocked() {}


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

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

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

LLVM IR (-O2):
define void @g_async_queue_pop_unlocked() {
ret void
}
void gf8mul_00100101(void) {
  __asm__ __volatile__("\tpxor    %xmm7, %xmm6\n"
                       "\tpxor    %xmm7, %xmm5\n"
                       "\tpxor    %xmm7, %xmm4\n"
                       "\tpxor    %xmm7, %xmm3\n"
                       "\tpxor    %xmm7, %xmm2\n"
                       "\tpxor    %xmm7, %xmm0\n"
                       "\tpxor    %xmm6, %xmm7\n"
                       "\tpxor    %xmm6, %xmm3\n"
                       "\tpxor    %xmm7, %xmm6\n"
                       "\tpxor    %xmm5, %xmm6\n"
                       "\tpxor    %xmm5, %xmm2\n"
                       "\tpxor    %xmm6, %xmm5\n"
                       "\tpxor    %xmm4, %xmm5\n"
                       "\tpxor    %xmm4, %xmm1\n"
                       "\tpxor    %xmm5, %xmm4\n"
                       "\tpxor    %xmm3, %xmm4\n"
                       "\tpxor    %xmm3, %xmm0\n"
                       "\tpxor    %xmm4, %xmm3\n"
                       "\tpxor    %xmm2, %xmm7\n"
                       "\tpxor    %xmm2, %xmm4\n"
                       "\tpxor    %xmm1, %xmm6\n"
                       "\tpxor    %xmm1, %xmm3\n"
                       "\tpxor    %xmm0, %xmm5\n"
                       "\tpxor    %xmm0, %xmm2\n");
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
pxor   %xmm7,%xmm6
pxor   %xmm7,%xmm5
pxor   %xmm7,%xmm4
pxor   %xmm7,%xmm3
pxor   %xmm7,%xmm2
pxor   %xmm7,%xmm0
pxor   %xmm6,%xmm7
pxor   %xmm6,%xmm3
pxor   %xmm7,%xmm6
pxor   %xmm5,%xmm6
pxor   %xmm5,%xmm2
pxor   %xmm6,%xmm5
pxor   %xmm4,%xmm5
pxor   %xmm4,%xmm1
pxor   %xmm5,%xmm4
pxor   %xmm3,%xmm4
pxor   %xmm3,%xmm0
pxor   %xmm4,%xmm3
pxor   %xmm2,%xmm7
pxor   %xmm2,%xmm4
pxor   %xmm1,%xmm6
pxor   %xmm1,%xmm3
pxor   %xmm0,%xmm5
pxor   %xmm0,%xmm2
pop    %rbp
ret

x86 assembly (clang, -O2):
pxor   %xmm7,%xmm6
pxor   %xmm7,%xmm5
pxor   %xmm7,%xmm4
pxor   %xmm7,%xmm3
pxor   %xmm7,%xmm2
pxor   %xmm7,%xmm0
pxor   %xmm6,%xmm7
pxor   %xmm6,%xmm3
pxor   %xmm7,%xmm6
pxor   %xmm5,%xmm6
pxor   %xmm5,%xmm2
pxor   %xmm6,%xmm5
pxor   %xmm4,%xmm5
pxor   %xmm4,%xmm1
pxor   %xmm5,%xmm4
pxor   %xmm3,%xmm4
pxor   %xmm3,%xmm0
pxor   %xmm4,%xmm3
pxor   %xmm2,%xmm7
pxor   %xmm2,%xmm4
pxor   %xmm1,%xmm6
pxor   %xmm1,%xmm3
pxor   %xmm0,%xmm5
pxor   %xmm0,%xmm2
ret

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

LLVM IR (-O2):
define void @gf8mul_00100101() {
tail call void asm sideeffect "\09pxor %xmm7, %xmm6\0A\09pxor %xmm7, %xmm5\0A\09pxor %xmm7, %xmm4\0A\09pxor %xmm7, %xmm3\0A\09pxor %xmm7, %xmm2\0A\09pxor %xmm7, %xmm0\0A\09pxor %xmm6, %xmm7\0A\09pxor %xmm6, %xmm3\0A\09pxor %xmm7, %xmm6\0A\09pxor %xmm5, %xmm6\0A\09pxor %xmm5, %xmm2\0A\09pxor %xmm6, %xmm5\0A\09pxor %xmm4, %xmm5\0A\09pxor %xmm4, %xmm1\0A\09pxor %xmm5, %xmm4\0A\09pxor %xmm3, %xmm4\0A\09pxor %xmm3, %xmm0\0A\09pxor %xmm4, %xmm3\0A\09pxor %xmm2, %xmm7\0A\09pxor %xmm2, %xmm4\0A\09pxor %xmm1, %xmm6\0A\09pxor %xmm1, %xmm3\0A\09pxor %xmm0, %xmm5\0A\09pxor %xmm0, %xmm2\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int close(int);
int tcpsocket_close(int socketfd) {
  int nRet = -1;
  if (socketfd > 0) {
    nRet = close(socketfd);
  }
  return nRet;
}


x86 assembly (clang, -O0):
<tcpsocket_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1137 <tcpsocket_close+0x27>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcpsocket_close>:
test   %edi,%edi
jle    1119 <tcpsocket_close+0x9>
jmp    1030 <close@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @tcpsocket_close(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
%6 = phi i32 [ %4, %3 ], [ -1, %1 ]
ret i32 %6
}
void gtk_layout_set_size() {}


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

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

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

LLVM IR (-O2):
define void @gtk_layout_set_size() {
ret void
}
/* Variables and functions */
float floatsum(float *in, size_t size) {
  float *pt, *fpt;
  double sum = 0;
  fpt = in + size;
  pt = in;
  while (pt < fpt)
    sum += *pt++;
  return sum;
}


x86 assembly (clang, -O0):
<floatsum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1163 <floatsum+0x63>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    112f <floatsum+0x2f>
movsd  -0x28(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatsum>:
test   %rsi,%rsi
jle    112a <floatsum+0x2a>
lea    (%rdi,%rsi,4),%rax
xorpd  %xmm0,%xmm0
nopl   (%rax)
movss  (%rdi),%xmm1
add    $0x4,%rdi
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
cmp    %rax,%rdi
jb     1110 <floatsum+0x10>
cvtsd2ss %xmm0,%xmm0
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @floatsum(float* %0, i64 %1) {
%3 = alloca float*
%4 = alloca i64
%5 = alloca float*
%6 = alloca float*
%7 = alloca double
store float* %0, float** %3
store i64 %1, i64* %4
store double 0.000000e+00, double* %7
%8 = load float*, float** %3
%9 = load i64, i64* %4
%10 = getelementptr inbounds float, float* %8, i64 %9
store float* %10, float** %6
%11 = load float*, float** %3
store float* %11, float** %5
br label %12
12: ; preds = %16, %2
%13 = load float*, float** %5
%14 = load float*, float** %6
%15 = icmp ult float* %13, %14
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load float*, float** %5
%18 = getelementptr inbounds float, float* %17, i32 1
store float* %18, float** %5
%19 = load float, float* %17
%20 = fpext float %19 to double
%21 = load double, double* %7
%22 = fadd double %21, %20
store double %22, double* %7
br label %12
23: ; preds = %12
%24 = load double, double* %7
%25 = fptrunc double %24 to float
ret float %25
}

LLVM IR (-O2):
define float @floatsum(float* %0, i64 %1) {
%3 = getelementptr inbounds float, float* %0, i64 %1
%4 = icmp sgt i64 %1, 0
br i1 %4, label %5, label %15
5: ; preds = %2, %5
%6 = phi double [ %11, %5 ], [ 0.000000e+00, %2 ]
%7 = phi float* [ %8, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds float, float* %7, i64 1
%9 = load float, float* %7
%10 = fpext float %9 to double
%11 = fadd double %6, %10
%12 = icmp ult float* %8, %3
br i1 %12, label %5, label %13
13: ; preds = %5
%14 = fptrunc double %11 to float
br label %15
15: ; preds = %13, %2
%16 = phi float [ 0.000000e+00, %2 ], [ %14, %13 ]
ret float %16
}
/* Variables and functions */
int /*<<< orphan*/ pthread_setname_np(char *);
int /*<<< orphan*/ sleep(int);
void *third_thread(void *in) {
  pthread_setname_np("third thread");
  while (1)
    sleep(1);
  return NULL;
}


x86 assembly (clang, -O0):
<third_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <pthread_setname_np@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    1138 <third_thread+0x18>

x86 assembly (clang, -O2):
<third_thread>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <pthread_setname_np@plt>
nopl   (%rax)
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    1130 <third_thread+0x10>

LLVM IR (-O0):
@.str = [13 x i8] c"third thread\00"
define i8* @third_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @pthread_setname_np(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %1, %4
%5 = call i32 @sleep(i32 1)
br label %4
}

LLVM IR (-O2):
@.str = [13 x i8] c"third thread\00"
define noalias i8* @third_thread(i8* nocapture readnone %0) {
%2 = tail call i32 @pthread_setname_np(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = tail call i32 @sleep(i32 1)
br label %3
}
void ADC0_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @ADC0_SaveConfig() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ smc(int);
void N_Siq(void) { smc(0x4); }


x86 assembly (clang, -O0):
<N_Siq>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <smc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<N_Siq>:
mov    $0x4,%edi
jmp    1030 <smc@plt>

LLVM IR (-O0):
define void @N_Siq() {
%1 = call i32 @smc(i32 4)
ret void
}

LLVM IR (-O2):
define void @N_Siq() {
%1 = tail call i32 @smc(i32 4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ raw();
int /*<<< orphan*/ wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void Continue(WINDOW *win) {
  mvwaddstr(win, 10, 1, " Press any key to continue");
  wrefresh(win);
  raw();
  wgetch(win);
  wrefresh(win);
}


x86 assembly (clang, -O0):
<Continue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
lea    0xe9f(%rip),%rcx
call   1060 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    $0x0,%al
call   1040 <raw@plt>
mov    -0x8(%rbp),%rdi
call   1050 <wgetch@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Continue>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rcx
mov    $0xa,%esi
mov    $0x1,%edx
call   1060 <mvwaddstr@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
xor    %eax,%eax
call   1040 <raw@plt>
mov    %rbx,%rdi
call   1050 <wgetch@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <wrefresh@plt>

LLVM IR (-O0):
@.str = [27 x i8] c" Press any key to continue\00"
define void @Continue(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @mvwaddstr(i32* %3, i32 10, i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @wrefresh(i32* %5)
%7 = call i32 (...) @raw()
%8 = load i32*, i32** %2
%9 = call i32 @wgetch(i32* %8)
%10 = load i32*, i32** %2
%11 = call i32 @wrefresh(i32* %10)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c" Press any key to continue\00"
define void @Continue(i32* %0) {
%2 = tail call i32 @mvwaddstr(i32* %0, i32 10, i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @wrefresh(i32* %0)
%4 = tail call i32 (...) @raw()
%5 = tail call i32 @wgetch(i32* %0)
%6 = tail call i32 @wrefresh(i32* %0)
ret void
}
int test_03(const char *x, const char *y) {
  return __builtin_strcmp(__builtin_assume_aligned(x, 4),
                          __builtin_assume_aligned(y, 4));
}


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

x86 assembly (clang, -O2):
<test_03>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @test_03(i8* %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int get_no_of_guesses(void) {
  int no_of_guesses = 0;
  while (no_of_guesses < 1) {
    printf("Enter a positive number for the number of guesses you need: ");
    scanf("%d", &no_of_guesses);
  }
  return no_of_guesses;
}


x86 assembly (clang, -O0):
<get_no_of_guesses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    115a <get_no_of_guesses+0x3a>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
jmp    112f <get_no_of_guesses+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_no_of_guesses>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xec8(%rip),%r14
lea    0xefe(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1150 <get_no_of_guesses+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Enter a positive number for the number of guesses you need: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_no_of_guesses() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %2
8: ; preds = %2
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [61 x i8] c"Enter a positive number for the number of guesses you need: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_no_of_guesses() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %3, label %8
8: ; preds = %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
double *malloc(int);
int main() {
  double *test = malloc(sizeof(double) * 3);
  test[1] = 9;
  free(test);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x18,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xeb7(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x18,%edi
call   1040 <malloc@plt>
movabs $0x4022000000000000,%rcx
mov    %rcx,0x8(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double*
store i32 0, i32* %1
%3 = call double* @malloc(i32 24)
store double* %3, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 1
store double 9.000000e+00, double* %5
%6 = load double*, double** %2
%7 = call i32 @free(double* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double* @malloc(i32 24)
%2 = getelementptr inbounds double, double* %1, i64 1
store double 9.000000e+00, double* %2
%3 = tail call i32 @free(double* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ displayLCDNumber(int, int, int, int);
int /*<<< orphan*/ mecanum_Drive(int, int /*<<< orphan*/);
int /*<<< orphan*/ speed();
int /*<<< orphan*/ tank_Drive(int, int /*<<< orphan*/);
void driveMode(int choice, int threshold) {
  displayLCDNumber(1, 10, choice, 2);
  if (choice == 1) {
    mecanum_Drive(threshold, speed());
  } else {
    tank_Drive(threshold, speed());
  }
}


x86 assembly (clang, -O0):
<driveMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x2,%ecx
call   1050 <displayLCDNumber@plt>
cmpl   $0x1,-0x4(%rbp)
jne    118b <driveMode+0x4b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <speed@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1040 <mecanum_Drive@plt>
jmp    11a2 <driveMode+0x62>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <speed@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1030 <tank_Drive@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<driveMode>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x1,%edi
mov    $0xa,%esi
mov    %ebp,%edx
mov    $0x2,%ecx
call   1050 <displayLCDNumber@plt>
xor    %eax,%eax
call   1060 <speed@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
cmp    $0x1,%ebp
jne    1178 <driveMode+0x38>
pop    %rbx
pop    %rbp
jmp    1040 <mecanum_Drive@plt>
pop    %rbx
pop    %rbp
jmp    1030 <tank_Drive@plt>

LLVM IR (-O0):
define void @driveMode(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 = call i32 @displayLCDNumber(i32 1, i32 10, i32 %5, i32 2)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 (...) @speed()
%12 = call i32 @mecanum_Drive(i32 %10, i32 %11)
br label %17
13: ; preds = %2
%14 = load i32, i32* %4
%15 = call i32 (...) @speed()
%16 = call i32 @tank_Drive(i32 %14, i32 %15)
br label %17
17: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
define void @driveMode(i32 %0, i32 %1) {
%3 = tail call i32 @displayLCDNumber(i32 1, i32 10, i32 %0, i32 2)
%4 = icmp eq i32 %0, 1
%5 = tail call i32 (...) @speed()
br i1 %4, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @mecanum_Drive(i32 %1, i32 %5)
br label %10
8: ; preds = %2
%9 = tail call i32 @tank_Drive(i32 %1, i32 %5)
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int ut_main_impl(int, char **);
int unittest_main(int argc, char *argv[]) { return (ut_main_impl(argc, argv)); }


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

x86 assembly (clang, -O2):
<unittest_main>:
jmp    1030 <ut_main_impl@plt>

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

LLVM IR (-O2):
define i32 @unittest_main(i32 %0, i8** %1) {
%3 = tail call i32 @ut_main_impl(i32 %0, i8** %1)
ret i32 %3
}
int kbd_lock(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @kbd_lock() {
ret i32 1
}

LLVM IR (-O2):
define i32 @kbd_lock() {
ret i32 1
}
/* Variables and functions */
int qdelete();
int /*<<< orphan*/ qinsert(int);
int roundRobin() {
  int next = qdelete();
  qinsert(next);
  return next;
}


x86 assembly (clang, -O0):
<roundRobin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <qdelete@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <qinsert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundRobin>:
push   %rbx
xor    %eax,%eax
call   1030 <qdelete@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <qinsert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roundRobin() {
%1 = alloca i32
%2 = call i32 (...) @qdelete()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @qinsert(i32 %3)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @roundRobin() {
%1 = tail call i32 (...) @qdelete()
%2 = tail call i32 @qinsert(i32 %1)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void arg_wf(void) { printf("wf\n"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"wf\0A\00"
define void @arg_wf() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [3 x i8] c"wf\00"
define void @arg_wf() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RamRead(unsigned char, unsigned char, unsigned short *);
void RamReadA(unsigned short RamAddr, void *ReadData) {
  unsigned char RamAddrH = RamAddr >> 8;
  unsigned char RamAddrL = RamAddr & 0xFF;
  RamRead(RamAddrH, RamAddrL, (unsigned short *)ReadData);
}


x86 assembly (clang, -O0):
<RamReadA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x11(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x12(%rbp)
mov    -0x11(%rbp),%cl
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rdx
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <RamRead@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RamReadA>:
mov    %rsi,%rdx
movzbl %dil,%esi
shr    $0x8,%edi
jmp    1030 <RamRead@plt>

LLVM IR (-O0):
define void @RamReadA(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i16 %0, i16* %3
store i8* %1, i8** %4
%7 = load i16, i16* %3
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 8
%10 = trunc i32 %9 to i8
store i8 %10, i8* %5
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
store i8 %14, i8* %6
%15 = load i8, i8* %5
%16 = load i8, i8* %6
%17 = load i8*, i8** %4
%18 = bitcast i8* %17 to i16*
%19 = call i32 @RamRead(i8 zeroext %15, i8 zeroext %16, i16* %18)
ret void
}

LLVM IR (-O2):
define void @RamReadA(i16 zeroext %0, i8* %1) {
%3 = lshr i16 %0, 8
%4 = trunc i16 %3 to i8
%5 = trunc i16 %0 to i8
%6 = bitcast i8* %1 to i16*
%7 = tail call i32 @RamRead(i8 zeroext %4, i8 zeroext %5, i16* %6)
ret void
}
/* Variables and functions */
double RAND_MAX;
double rand();
unsigned long get_randnum(unsigned long min, unsigned long max) {
  return min + (unsigned long)((float)max * (rand() / (RAND_MAX + 1.0)));
}


x86 assembly (clang, -O0):
<get_randnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x18(%rbp)
test   %rax,%rax
movss  %xmm0,-0x14(%rbp)
js     1165 <get_randnum+0x55>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    -0x20(%rbp),%rax
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mov    0x2e5b(%rip),%rcx
movsd  (%rcx),%xmm2
movsd  0xe67(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rcx
mov    %rcx,%rsi
sar    $0x3f,%rsi
movsd  0xe4c(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdx
and    %rsi,%rdx
or     %rdx,%rcx
add    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_randnum>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
test   %rsi,%rsi
js     1124 <get_randnum+0x14>
cvtsi2ss %rsi,%xmm0
jmp    1139 <get_randnum+0x29>
mov    %rsi,%rax
shr    %rax
and    $0x1,%esi
or     %rax,%rsi
cvtsi2ss %rsi,%xmm0
addss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2e97(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%rcx
mov    %rcx,%rdx
subsd  0xe91(%rip),%xmm0
cvttsd2si %xmm0,%rax
sar    $0x3f,%rdx
and    %rdx,%rax
or     %rcx,%rax
add    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i64 @get_randnum(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 = uitofp i64 %6 to float
%8 = fpext float %7 to double
%9 = call double (...) @rand()
%10 = load double, double* @RAND_MAX
%11 = fadd double %10, 1.000000e+00
%12 = fdiv double %9, %11
%13 = fmul double %8, %12
%14 = fptoui double %13 to i64
%15 = add i64 %5, %14
ret i64 %15
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i64 @get_randnum(i64 %0, i64 %1) {
%3 = uitofp i64 %1 to float
%4 = fpext float %3 to double
%5 = tail call double (...) @rand()
%6 = load double, double* @RAND_MAX
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %5, %7
%9 = fmul double %8, %4
%10 = fptoui double %9 to i64
%11 = add i64 %10, %0
ret i64 %11
}